]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
replaced getline with util_getline
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index e5d1a5603bb5965cb7d31c9eedab700771063161..d9e3a9c4c1a1ad7d4b9f8de5b9bf1ff46b0e4d68 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -160,7 +160,9 @@ void *util_memory_a(unsigned int, unsigned int, const char *);
 void  util_memory_d(void       *, unsigned int, const char *);
 char *util_strdup  (const char *);
 char *util_strrq   (char *);
+char *util_strrnl  (char *);
 void  util_debug   (const char *, const char *, ...);
+int   util_getline (char **, size_t *, FILE *);
 
 #ifdef NOTRACK
 #      define mem_a(x) malloc(x)
@@ -181,11 +183,12 @@ void  util_debug   (const char *, const char *, ...);
             } else {                                                     \
                 N##_allocated *= 2;                                      \
             }                                                            \
-            void *temp = realloc(N##_data, (N##_allocated * sizeof(T))); \
+            void *temp = mem_a(N##_allocated * sizeof(T));               \
             if  (!temp) {                                                \
                 free(temp);                                              \
                 return -1;                                               \
             }                                                            \
+            memcpy(temp, N##_data, (N##_elements * sizeof(T)));          \
             N##_data = (T*)temp;                                         \
         }                                                                \
         N##_data[N##_elements] = element;                                \