mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 06:42:26 +00:00
Clean up after myself in the Z_* purge..
This commit is contained in:
parent
def35745d7
commit
750457b368
8 changed files with 17 additions and 16 deletions
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
#ifndef _ZONE_H
|
||||
#define _ZONE_H
|
||||
|
||||
/*
|
||||
memory allocation
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ server_entry_t *SL_Add (server_entry_t *start, char *ip, char *desc) {
|
|||
server_entry_t *p;
|
||||
p = start;
|
||||
if (!start) { //Nothing at beginning of list, create it
|
||||
start = malloc(sizeof(server_entry_t));
|
||||
start = calloc(1, sizeof(server_entry_t));
|
||||
start->prev = 0;
|
||||
start->next = 0;
|
||||
start->server = malloc(strlen(ip) + 1);
|
||||
|
@ -57,7 +57,7 @@ server_entry_t *SL_Add (server_entry_t *start, char *ip, char *desc) {
|
|||
|
||||
for(p=start;p->next;p=p->next); //Get to end of list
|
||||
|
||||
p->next = malloc(sizeof(server_entry_t));
|
||||
p->next = calloc(1, sizeof(server_entry_t));
|
||||
p->next->prev = p;
|
||||
p->next->server = malloc(strlen(ip) + 1);
|
||||
p->next->desc = malloc(strlen(desc) + 1);
|
||||
|
@ -95,7 +95,7 @@ server_entry_t *SL_InsB (server_entry_t *start, server_entry_t *place, char *ip,
|
|||
server_entry_t *new;
|
||||
server_entry_t *other;
|
||||
|
||||
new = malloc(sizeof(server_entry_t));
|
||||
new = calloc(1, sizeof(server_entry_t));
|
||||
new->server = malloc(strlen(ip) + 1);
|
||||
new->desc = malloc(strlen(desc) + 1);
|
||||
strcpy(new->server,ip);
|
||||
|
|
|
@ -425,7 +425,7 @@ void Cmd_Alias_f (void)
|
|||
|
||||
if (!a)
|
||||
{
|
||||
a = malloc (sizeof(cmdalias_t));
|
||||
a = calloc (1, sizeof(cmdalias_t));
|
||||
a->next = cmd_alias;
|
||||
cmd_alias = a;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ void Cvar_Alias_Get (char *name, cvar_t *cvar)
|
|||
var = Cvar_FindAlias(name);
|
||||
if (!var)
|
||||
{
|
||||
alias = (cvar_alias_t *) malloc(sizeof(cvar_alias_t));
|
||||
alias = (cvar_alias_t *) calloc(1, sizeof(cvar_alias_t));
|
||||
alias->next = calias_vars;
|
||||
calias_vars = alias;
|
||||
alias->name = strdup(name);
|
||||
|
@ -442,7 +442,7 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description)
|
|||
v = Cvar_FindVar(name);
|
||||
if (!v)
|
||||
{
|
||||
v = (cvar_t *) malloc(sizeof(cvar_t));
|
||||
v = (cvar_t *) calloc(1, sizeof(cvar_t));
|
||||
// Cvar doesn't exist, so we create it
|
||||
v->next = cvar_vars;
|
||||
cvar_vars = v;
|
||||
|
|
|
@ -69,7 +69,7 @@ opendir (const char *szPath)
|
|||
|
||||
/* Allocate enough space to store DIR structure and the complete
|
||||
* directory path given. */
|
||||
nd = (DIR *) malloc (sizeof (DIR) + strlen (szPath) + strlen (SLASH) +
|
||||
nd = (DIR *) calloc (1, sizeof (DIR) + strlen (szPath) + strlen (SLASH) +
|
||||
strlen (SUFFIX));
|
||||
|
||||
if (!nd)
|
||||
|
|
|
@ -96,7 +96,7 @@ void COM_InitArgv (int argc, char **argv)
|
|||
|
||||
safe = false;
|
||||
|
||||
largv = (char**)malloc ((argc + NUM_SAFE_ARGVS + 1) * sizeof (char**));
|
||||
largv = (char**)calloc (1, (argc + NUM_SAFE_ARGVS + 1) * sizeof (char**));
|
||||
|
||||
for (com_argc=0, len=0 ; com_argc < argc ; com_argc++)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ void COM_InitArgv (int argc, char **argv)
|
|||
len += strlen (argv[com_argc]) + 1;
|
||||
}
|
||||
|
||||
com_cmdline = (char*)malloc (len+1); // need strlen(com_cmdline)+2
|
||||
com_cmdline = (char*)calloc (1, len+1); // need strlen(com_cmdline)+2
|
||||
com_cmdline[0] = 0;
|
||||
if (len) {
|
||||
for (i=1; i < argc; i++)
|
||||
|
|
|
@ -509,7 +509,7 @@ COM_LoadFile (char *path, int usehunk)
|
|||
else if (usehunk == 2)
|
||||
buf = Hunk_TempAlloc (len+1);
|
||||
else if (usehunk == 0)
|
||||
buf = malloc (len+1);
|
||||
buf = calloc (1, len+1);
|
||||
else if (usehunk == 3)
|
||||
buf = Cache_Alloc (loadcache, len+1, base);
|
||||
else if (usehunk == 4)
|
||||
|
@ -604,7 +604,7 @@ COM_LoadPackFile (char *packfile)
|
|||
if (numpackfiles > MAX_FILES_IN_PACK)
|
||||
Sys_Error ("%s has %i files", packfile, numpackfiles);
|
||||
|
||||
newfiles = malloc (numpackfiles * sizeof(packfile_t));
|
||||
newfiles = calloc (1, numpackfiles * sizeof(packfile_t));
|
||||
|
||||
fseek (packhandle, header.dirofs, SEEK_SET);
|
||||
fread (info, 1, header.dirlen, packhandle);
|
||||
|
@ -618,7 +618,7 @@ COM_LoadPackFile (char *packfile)
|
|||
newfiles[i].filelen = LittleLong(info[i].filelen);
|
||||
}
|
||||
|
||||
pack = malloc (sizeof (pack_t));
|
||||
pack = calloc (1, sizeof (pack_t));
|
||||
strcpy (pack->filename, packfile);
|
||||
pack->handle = packhandle;
|
||||
pack->numfiles = numpackfiles;
|
||||
|
@ -676,7 +676,7 @@ COM_LoadGameDirectory(char *dir)
|
|||
|
||||
Con_DPrintf ("COM_LoadGameDirectory (\"%s\")\n", dir);
|
||||
|
||||
pakfiles = malloc(FBLOCK_SIZE * sizeof(char *));
|
||||
pakfiles = calloc(1, FBLOCK_SIZE * sizeof(char *));
|
||||
bufsize += FBLOCK_SIZE;
|
||||
if (!pakfiles)
|
||||
goto COM_LoadGameDirectory_free;
|
||||
|
@ -720,7 +720,7 @@ COM_LoadGameDirectory(char *dir)
|
|||
if (!pak) {
|
||||
Sys_Error(va("Bad pakfile %s!!", pakfiles[i]));
|
||||
} else {
|
||||
search = malloc (sizeof(searchpath_t));
|
||||
search = calloc (1, sizeof(searchpath_t));
|
||||
search->pack = pak;
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
|
@ -760,7 +760,7 @@ COM_AddDirectory (char *dir)
|
|||
//
|
||||
// add the directory to the search path
|
||||
//
|
||||
search = malloc (sizeof(searchpath_t));
|
||||
search = calloc (1, sizeof(searchpath_t));
|
||||
strcpy (search->filename, dir);
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
|
|
|
@ -869,7 +869,7 @@ void SCR_RSShot_f (void)
|
|||
fracw = (float)vid.width / (float)w;
|
||||
frach = (float)vid.height / (float)h;
|
||||
|
||||
newbuf = malloc(w*h);
|
||||
newbuf = calloc(1, w*h);
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
dest = newbuf + (w * y);
|
||||
|
|
Loading…
Reference in a new issue