]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
mallocs, callocs, and frees changed to qmalloc/qfree
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 15 Oct 2001 17:12:15 +0000 (17:12 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 15 Oct 2001 17:12:15 +0000 (17:12 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@924 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c
console.c
model_brush.c
quakeio.c

diff --git a/cmd.c b/cmd.c
index a8349082bc0b8344bcb87bf8783d9acb00f725a0..71f476b7d2e1d7a7ae61d893466c019f52679546 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -692,7 +692,7 @@ Cmd_CompleteBuildList (char *partial)
        char                    **buf;
 
        len = strlen(partial);
-       buf = malloc(sizeofbuf + sizeof (char *));
+       buf = qmalloc(sizeofbuf + sizeof (char *));
        // Loop through the alias list and print all matches
        for (cmd = cmd_functions; cmd; cmd = cmd->next)
                if (!strncasecmp(partial, cmd->name, len))
@@ -780,7 +780,7 @@ Cmd_CompleteAliasBuildList (char *partial)
        char            **buf;
 
        len = strlen(partial);
-       buf = malloc(sizeofbuf + sizeof (char *));
+       buf = qmalloc(sizeofbuf + sizeof (char *));
        // Loop through the alias list and print all matches
        for (alias = cmd_alias; alias; alias = alias->next)
                if (!strncasecmp(partial, alias->name, len))
index a834765d274a687e2ba8853a348ae09515698ec2..1065d847febc4cddc0b1237b06a8813ad60f8383 100644 (file)
--- a/console.c
+++ b/console.c
@@ -799,6 +799,6 @@ Con_CompleteCommandLine (void)
        }
        for (i = 0; i < 3; i++)
                if (list[i])
-                       free (list[i]);
+                       qfree (list[i]);
 }
 
index 70eae3a607639f89168cfc27d95b0fdb85a98bfe..81a06f6655dc1c763ee22847e017a2dd73096229 100644 (file)
@@ -1199,7 +1199,7 @@ winding_t *NewWinding (int points)
                Host_Error("NewWinding: too many points\n");
 
        size = (int)((winding_t *)0)->points[points];
-       w = malloc (size);
+       w = qmalloc (size);
        memset (w, 0, size);
 
        return w;
@@ -1207,7 +1207,7 @@ winding_t *NewWinding (int points)
 
 void FreeWinding (winding_t *w)
 {
-       free (w);
+       qfree (w);
 }
 
 /*
@@ -1475,7 +1475,7 @@ AllocPortal
 portal_t *AllocPortal (void)
 {
        portal_t *p;
-       p = malloc(sizeof(portal_t));
+       p = qmalloc(sizeof(portal_t));
        memset(p, 0, sizeof(portal_t));
        p->chain = portalchain;
        portalchain = p;
@@ -1602,7 +1602,7 @@ void Mod_FinalizePortals(void)
                        }
                        FreeWinding(p->winding);
                }
-               free(p);
+               qfree(p);
                p = pnext;
        }
 }
index 6e475ccb938fc46ce32f4d4769b276df8607dc54..2610e45026209c40b091c45ad8ea8601197edcd4 100644 (file)
--- a/quakeio.c
+++ b/quakeio.c
@@ -132,14 +132,15 @@ Qopen (const char *path, const char *mode)
        }
        *p = 0;
 
-       file = calloc (sizeof (*file), 1);
+       file = qmalloc (sizeof (*file));
+       memset(file, 0, sizeof(*file));
        if (!file)
                return 0;
 #ifdef HAVE_ZLIB
        if (zip) {
                file->gzfile = gzopen (path, m);
                if (!file->gzfile) {
-                       free (file);
+                       qfree (file);
                        return 0;
                }
        } else
@@ -147,7 +148,7 @@ Qopen (const char *path, const char *mode)
        {
                file->file = fopen (path, m);
                if (!file->file) {
-                       free (file);
+                       qfree (file);
                        return 0;
                }
        }
@@ -171,14 +172,15 @@ Qdopen (int fd, const char *mode)
 
        *p = 0;
 
-       file = calloc (sizeof (*file), 1);
+       file = qmalloc (sizeof (*file));
+       memset(file, 0, sizeof(*file));
        if (!file)
                return 0;
 #ifdef HAVE_ZLIB
        if (zip) {
                file->gzfile = gzdopen (fd, m);
                if (!file->gzfile) {
-                       free (file);
+                       qfree (file);
                        return 0;
                }
        } else
@@ -186,7 +188,7 @@ Qdopen (int fd, const char *mode)
        {
                file->file = fdopen (fd, m);
                if (!file->file) {
-                       free (file);
+                       qfree (file);
                        return 0;
                }
        }
@@ -206,7 +208,7 @@ Qclose (QFile *file)
        else
                gzclose (file->gzfile);
 #endif
-       free (file);
+       qfree (file);
 }
 
 int