X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=opts.c;h=5a6cb40001521f980030f66025f17745fac0770d;hp=c669ee73b670c6bbc053d0eaa72c3d861c4e70b3;hb=a25bd052d73f59e1772f1eee2e8b11f1dedbc254;hpb=46892daa3ad6ad98706abfb00ea947658dca3aa7 diff --git a/opts.c b/opts.c index c669ee7..5a6cb40 100644 --- a/opts.c +++ b/opts.c @@ -142,6 +142,9 @@ void opts_setoptimlevel(unsigned int level) { size_t i; for (i = 0; i < COUNT_OPTIMIZATIONS; ++i) opts_set(opts.optimization, i, level >= opts_opt_oflag[i]); + + if (!level) + opts.optimizeoff = true; } /* @@ -190,7 +193,7 @@ static size_t opts_ini_parse ( char *read_name; char *read_value; - while (file_getline(&line, &linesize, filehandle) != EOF) { + while (fs_file_getline(&line, &linesize, filehandle) != EOF) { parse_beg = line; /* handle BOM */ @@ -254,7 +257,7 @@ static size_t opts_ini_parse ( static bool opts_ini_bool(const char *value) { if (!strcmp(value, "true")) return true; if (!strcmp(value, "false")) return false; - return !!atoi(value); + return !!strtoul(value, NULL, 10); } static char *opts_ini_load(const char *section, const char *name, const char *value) { @@ -345,11 +348,11 @@ void opts_ini_init(const char *file) { if (!file) { /* try ini */ - if (!(ini = file_open((file = "gmqcc.ini"), "r"))) + if (!(ini = fs_file_open((file = "gmqcc.ini"), "r"))) /* try cfg */ - if (!(ini = file_open((file = "gmqcc.cfg"), "r"))) + if (!(ini = fs_file_open((file = "gmqcc.cfg"), "r"))) return; - } else if (!(ini = file_open(file, "r"))) + } else if (!(ini = fs_file_open(file, "r"))) return; con_out("found ini file `%s`\n", file); @@ -360,5 +363,5 @@ void opts_ini_init(const char *file) { vec_free(error); } - file_close(ini); + fs_file_close(ini); }