]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - code.c
Update license headers
[xonotic/gmqcc.git] / code.c
diff --git a/code.c b/code.c
index 05ffe70ca3561a73fdb37645b042f04953ba86e4..6f040ce1c1155a4aafb18ec5d96f942bcd9fb37f 100644 (file)
--- a/code.c
+++ b/code.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2013
+ * Copyright (C) 2012, 2013, 2014, 2015
  *     Dale Weiler
  *     Wolfgang Bumiller
  *
@@ -37,7 +37,7 @@
  */
 typedef union {
     void   *enter;
-    qcint_t   leave;
+    qcint_t leave;
 } code_hash_entry_t;
 
 /* Some sanity macros */
@@ -260,26 +260,18 @@ static void code_create_header(code_t *code, prog_header_t *code_header, const c
     }
 
     /* ensure all data is in LE format */
-    util_endianswap(&code_header->version,    1, sizeof(code_header->version));
-    util_endianswap(&code_header->crc16,      1, sizeof(code_header->crc16));
-    util_endianswap(&code_header->statements, 2, sizeof(code_header->statements.offset));
-    util_endianswap(&code_header->defs,       2, sizeof(code_header->statements.offset));
-    util_endianswap(&code_header->fields,     2, sizeof(code_header->statements.offset));
-    util_endianswap(&code_header->functions,  2, sizeof(code_header->statements.offset));
-    util_endianswap(&code_header->strings,    2, sizeof(code_header->statements.offset));
-    util_endianswap(&code_header->globals,    2, sizeof(code_header->statements.offset));
-    util_endianswap(&code_header->entfield,   1, sizeof(code_header->entfield));
+    util_swap_header(code_header);
 
     /*
      * These are not part of the header but we ensure LE format here to save on duplicated
      * code.
      */
-    util_endianswap(code->statements, vec_size(code->statements), sizeof(prog_section_statement_t));
-    util_endianswap(code->defs,       vec_size(code->defs),       sizeof(prog_section_def_t));
-    util_endianswap(code->fields,     vec_size(code->fields),     sizeof(prog_section_field_t));
-    util_endianswap(code->functions,  vec_size(code->functions),  sizeof(prog_section_function_t));
-    util_endianswap(code->globals,    vec_size(code->globals),    sizeof(int32_t));
 
+    util_swap_statements (code->statements);
+    util_swap_defs_fields(code->defs);
+    util_swap_defs_fields(code->fields);
+    util_swap_functions  (code->functions);
+    util_swap_globals    (code->globals);
 
     if (!OPTS_OPTION_BOOL(OPTION_QUIET)) {
         if (lnofile)