mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 09:10:54 +00:00
zone.c: A little whitespace tidy-up here and there.
(hunk_t): Increased name array length to 24. Fixed the strncpy() calls into that field so that it will be null terminated. (cache_system_t): Increased name array length to 32. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@156 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
68361d51b1
commit
ba6f73616b
1 changed files with 15 additions and 13 deletions
12
Quake/zone.c
12
Quake/zone.c
|
@ -275,11 +275,12 @@ void Z_CheckHeap (void)
|
||||||
|
|
||||||
#define HUNK_SENTINAL 0x1df001ed
|
#define HUNK_SENTINAL 0x1df001ed
|
||||||
|
|
||||||
|
#define HUNKNAME_LEN 24
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int sentinal;
|
int sentinal;
|
||||||
int size; // including sizeof(hunk_t), -1 = not allocated
|
int size; // including sizeof(hunk_t), -1 = not allocated
|
||||||
char name[8];
|
char name[HUNKNAME_LEN];
|
||||||
} hunk_t;
|
} hunk_t;
|
||||||
|
|
||||||
byte *hunk_base;
|
byte *hunk_base;
|
||||||
|
@ -441,7 +442,7 @@ void *Hunk_AllocName (int size, char *name)
|
||||||
|
|
||||||
h->size = size;
|
h->size = size;
|
||||||
h->sentinal = HUNK_SENTINAL;
|
h->sentinal = HUNK_SENTINAL;
|
||||||
Q_strncpy (h->name, name, 8);
|
Q_strncpy (h->name, name, HUNKNAME_LEN - 1);
|
||||||
|
|
||||||
return (void *)(h+1);
|
return (void *)(h+1);
|
||||||
}
|
}
|
||||||
|
@ -532,7 +533,7 @@ void *Hunk_HighAllocName (int size, char *name)
|
||||||
memset (h, 0, size);
|
memset (h, 0, size);
|
||||||
h->size = size;
|
h->size = size;
|
||||||
h->sentinal = HUNK_SENTINAL;
|
h->sentinal = HUNK_SENTINAL;
|
||||||
Q_strncpy (h->name, name, 8);
|
Q_strncpy (h->name, name, sizeof(h->name)-1);
|
||||||
|
|
||||||
return (void *)(h+1);
|
return (void *)(h+1);
|
||||||
}
|
}
|
||||||
|
@ -574,11 +575,12 @@ CACHE MEMORY
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define CACHENAME_LEN 32
|
||||||
typedef struct cache_system_s
|
typedef struct cache_system_s
|
||||||
{
|
{
|
||||||
int size; // including this header
|
int size; // including this header
|
||||||
cache_user_t *user;
|
cache_user_t *user;
|
||||||
char name[16];
|
char name[CACHENAME_LEN];
|
||||||
struct cache_system_s *prev, *next;
|
struct cache_system_s *prev, *next;
|
||||||
struct cache_system_s *lru_prev, *lru_next; // for LRU flushing
|
struct cache_system_s *lru_prev, *lru_next; // for LRU flushing
|
||||||
} cache_system_t;
|
} cache_system_t;
|
||||||
|
@ -912,7 +914,7 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name)
|
||||||
cs = Cache_TryAlloc (size, false);
|
cs = Cache_TryAlloc (size, false);
|
||||||
if (cs)
|
if (cs)
|
||||||
{
|
{
|
||||||
strncpy (cs->name, name, sizeof(cs->name)-1);
|
strncpy (cs->name, name, CACHENAME_LEN - 1);
|
||||||
c->data = (void *)(cs+1);
|
c->data = (void *)(cs+1);
|
||||||
cs->user = c;
|
cs->user = c;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue