startgrid = bound(0, startgrid, size);
amplitude = 0xFFFF; // this gets halved before use
- noisebuf = malloc(size*size*sizeof(int));
+ noisebuf = Mem_Alloc (tempmempool, size * size * sizeof (*noisebuf));
memset(noisebuf, 0, size*size*sizeof(int));
for (g2 = startgrid;g2;g2 >>= 1)
for (y = 0;y < size;y++)
for (x = 0;x < size;x++)
*noise++ = (qbyte) (((n(x,y) - min) * 256) / max);
- free(noisebuf);
+ Mem_Free (noisebuf);
#undef n
}
void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
char *temp;
int templen;
-// copy off any commands still remaining in the exec buffer
+ // copy off any commands still remaining in the exec buffer
templen = cmd_text.cursize;
if (templen)
{
- temp = Z_Malloc (templen);
+ temp = Mem_Alloc (tempmempool, templen);
memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
else
- temp = NULL; // shut up compiler
+ temp = NULL;
-// add the entire text of the file
+ // add the entire text of the file
Cbuf_AddText (text);
-// add the copied off data
- if (templen)
+ // add the copied off data
+ if (temp != NULL)
{
SZ_Write (&cmd_text, temp, templen);
- Z_Free (temp);
+ Mem_Free (temp);
}
}
if (!s)
return;
- text = Z_Malloc (s+1);
+ text = Mem_Alloc (tempmempool, s + 1);
text[0] = 0;
for (i=1 ; i<com_argc ; i++)
{
strcat (text, " ");
}
-// pull out the commands
- build = Z_Malloc (s+1);
+ // pull out the commands
+ build = Mem_Alloc (tempmempool, s + 1);
build[0] = 0;
for (i=0 ; i<s-1 ; i++)
if (build[0])
Cbuf_InsertText (build);
- Z_Free (text);
- Z_Free (build);
+ Mem_Free (text);
+ Mem_Free (build);
}
Creates a new command that executes a command string (possibly ; seperated)
===============
*/
-static char *CopyString (char *in)
-{
- char *out;
-
- out = Z_Malloc (strlen(in)+1);
- strcpy (out, in);
- return out;
-}
-
static void Cmd_Alias_f (void)
{
cmdalias_t *a;
}
strlcat (cmd, "\n", sizeof (cmd));
- a->value = CopyString (cmd);
+ a->value = Z_Malloc (strlen (cmd) + 1);
+ strcpy (a->value, cmd);
}
/*
if (separator < colon)
separator = colon;
basepathlength = separator - pattern;
- basepath = Z_Malloc(basepathlength + 1);
+ basepath = Mem_Alloc (tempmempool, basepathlength + 1);
if (basepathlength)
memcpy(basepath, pattern, basepathlength);
basepath[basepathlength] = 0;
stringlistfree(liststart);
}
- Z_Free(basepath);
+ Mem_Free(basepath);
return search;
}