]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - opts.c
Holy mexicans 15% better hashing == 5% faster compiles.
[xonotic/gmqcc.git] / opts.c
diff --git a/opts.c b/opts.c
index e37ba7356d78ad6bdace480b77113c1d75863b25..e6ca420bb4a0b18ca41a1be97b12e237fc4f333b 100644 (file)
--- a/opts.c
+++ b/opts.c
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2012, 2013
  *     Wolfgang Bumiller
- *     Dale Weiler 
+ *     Dale Weiler
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy of
  * this software and associated documentation files (the "Software"), to deal in
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
 #include "gmqcc.h"
+
 unsigned int opts_optimizationcount[COUNT_OPTIMIZATIONS];
 opts_cmd_t   opts; /* command lien options */
 
-static void opts_setdefault() {
+static void opts_setdefault(void) {
     memset(&opts, 0, sizeof(opts_cmd_t));
     OPTS_OPTION_BOOL(OPTION_CORRECTION) = true;
 
@@ -216,7 +221,7 @@ static size_t opts_ini_parse (
             /* section found */
             if (*(parse_end = opts_ini_next(parse_beg + 1, ']')) == ']') {
                 * parse_end = '\0'; /* terminate bro */
-                strncpy(section_data, parse_beg + 1, sizeof(section_data));
+                util_strncpy(section_data, parse_beg + 1, sizeof(section_data));
                 section_data[sizeof(section_data) - 1] = '\0';
                 *oldname_data                          = '\0';
             } else if (!error) {
@@ -237,7 +242,7 @@ static size_t opts_ini_parse (
                 opts_ini_rstrip(read_value);
 
                 /* valid name value pair, lets call down to handler */
-                strncpy(oldname_data, read_name, sizeof(oldname_data));
+                util_strncpy(oldname_data, read_name, sizeof(oldname_data));
                 oldname_data[sizeof(oldname_data) - 1] ='\0';
 
                 if ((*errorhandle = loadhandle(section_data, read_name, read_value)) && !error)
@@ -269,7 +274,7 @@ static char *opts_ini_load(const char *section, const char *name, const char *va
     /*
      * undef all of these because they may still be defined like in my
      * case they where.
-     */  
+     */
     #undef GMQCC_TYPE_FLAGS
     #undef GMQCC_TYPE_OPTIMIZATIONS
     #undef GMQCC_TYPE_WARNS
@@ -347,7 +352,7 @@ void opts_ini_init(const char *file) {
     size_t     line;
     FILE       *ini;
 
-    
+
     if (!file) {
         /* try ini */
         if (!(ini = fs_file_open((file = "gmqcc.ini"), "r")))
@@ -361,9 +366,9 @@ void opts_ini_init(const char *file) {
 
     if ((line = opts_ini_parse(ini, &opts_ini_load, &error)) != 0) {
         /* there was a parse error with the ini file */
-        con_printmsg(LVL_ERROR, file, line, "error", error);
+        con_printmsg(LVL_ERROR, file, line, 0 /*TODO: column for ini error*/, "error", error);
         vec_free(error);
     }
 
     fs_file_close(ini);
-}  
+}