OS: Remove usage of alloca
Replace with heap allocations.
This commit is contained in:
parent
2d738efb95
commit
2761c10331
10
os/oscolor.c
10
os/oscolor.c
|
@ -180,7 +180,7 @@ lookup(char *name, int len, Bool create)
|
||||||
dbEntryPtr entry, *prev = NULL;
|
dbEntryPtr entry, *prev = NULL;
|
||||||
char *str = name;
|
char *str = name;
|
||||||
|
|
||||||
if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL;
|
if (!(name = (char*)xalloc(len +1))) return NULL;
|
||||||
CopyISOLatin1Lowered((unsigned char *)name, (unsigned char *)str, len);
|
CopyISOLatin1Lowered((unsigned char *)name, (unsigned char *)str, len);
|
||||||
name[len] = '\0';
|
name[len] = '\0';
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ lookup(char *name, int len, Bool create)
|
||||||
strcpy( entry->name, name );
|
strcpy( entry->name, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
DEALLOCATE_LOCAL(name);
|
xfree(name);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
@ -225,13 +225,13 @@ OsInitColors(void)
|
||||||
|
|
||||||
if (!was_here)
|
if (!was_here)
|
||||||
{
|
{
|
||||||
path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5);
|
path = (char*)xalloc(strlen(rgbPath) +5);
|
||||||
strcpy(path, rgbPath);
|
strcpy(path, rgbPath);
|
||||||
strcat(path, ".txt");
|
strcat(path, ".txt");
|
||||||
if (!(rgb = fopen(path, "r")))
|
if (!(rgb = fopen(path, "r")))
|
||||||
{
|
{
|
||||||
ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
|
ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath );
|
||||||
DEALLOCATE_LOCAL(path);
|
xfree(path);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ OsInitColors(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(rgb);
|
fclose(rgb);
|
||||||
DEALLOCATE_LOCAL(path);
|
xfree(path);
|
||||||
|
|
||||||
was_here = TRUE;
|
was_here = TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user