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:
Ozkan Sezer 2010-04-26 20:40:18 +00:00
parent 68361d51b1
commit ba6f73616b

View file

@ -275,11 +275,12 @@ void Z_CheckHeap (void)
#define HUNK_SENTINAL 0x1df001ed
#define HUNKNAME_LEN 24
typedef struct
{
int sentinal;
int size; // including sizeof(hunk_t), -1 = not allocated
char name[8];
char name[HUNKNAME_LEN];
} hunk_t;
byte *hunk_base;
@ -441,7 +442,7 @@ void *Hunk_AllocName (int size, char *name)
h->size = size;
h->sentinal = HUNK_SENTINAL;
Q_strncpy (h->name, name, 8);
Q_strncpy (h->name, name, HUNKNAME_LEN - 1);
return (void *)(h+1);
}
@ -532,7 +533,7 @@ void *Hunk_HighAllocName (int size, char *name)
memset (h, 0, size);
h->size = size;
h->sentinal = HUNK_SENTINAL;
Q_strncpy (h->name, name, 8);
Q_strncpy (h->name, name, sizeof(h->name)-1);
return (void *)(h+1);
}
@ -574,11 +575,12 @@ CACHE MEMORY
===============================================================================
*/
#define CACHENAME_LEN 32
typedef struct cache_system_s
{
int size; // including this header
cache_user_t *user;
char name[16];
char name[CACHENAME_LEN];
struct cache_system_s *prev, *next;
struct cache_system_s *lru_prev, *lru_next; // for LRU flushing
} cache_system_t;
@ -912,7 +914,7 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name)
cs = Cache_TryAlloc (size, false);
if (cs)
{
strncpy (cs->name, name, sizeof(cs->name)-1);
strncpy (cs->name, name, CACHENAME_LEN - 1);
c->data = (void *)(cs+1);
cs->user = c;
break;