mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[zone] Use memccpy instead of strncpy
Probably the best way to tell gcc I know what I'm doing.
This commit is contained in:
parent
f7c14a9b39
commit
6a7f78485a
1 changed files with 3 additions and 3 deletions
|
@ -613,7 +613,7 @@ Hunk_RawAllocName (memhunk_t *hunk, size_t size, const char *name)
|
||||||
h->size = size;
|
h->size = size;
|
||||||
h->sentinal1 = HUNK_SENTINAL;
|
h->sentinal1 = HUNK_SENTINAL;
|
||||||
h->sentinal2 = HUNK_SENTINAL;
|
h->sentinal2 = HUNK_SENTINAL;
|
||||||
strncpy (h->name, name, sizeof (h->name));
|
memccpy (h->name, name, 0, sizeof (h->name));
|
||||||
|
|
||||||
return (void *) (h + 1);
|
return (void *) (h + 1);
|
||||||
}
|
}
|
||||||
|
@ -794,7 +794,7 @@ Cache_Move (cache_system_t *c)
|
||||||
|
|
||||||
memcpy (new + 1, c + 1, c->size - sizeof (cache_system_t));
|
memcpy (new + 1, c + 1, c->size - sizeof (cache_system_t));
|
||||||
new->user = c->user;
|
new->user = c->user;
|
||||||
strncpy (new->name, c->name, sizeof (new->name));
|
memccpy (new->name, c->name, 0, sizeof (new->name));
|
||||||
Cache_Free (c->user);
|
Cache_Free (c->user);
|
||||||
new->user->data = (void *) (new + 1);
|
new->user->data = (void *) (new + 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1142,7 +1142,7 @@ Cache_Alloc_r (memhunk_t *hunk, cache_user_t *c, size_t size, const char *name)
|
||||||
while (1) {
|
while (1) {
|
||||||
cs = Cache_TryAlloc (hunk, size, false);
|
cs = Cache_TryAlloc (hunk, size, false);
|
||||||
if (cs) {
|
if (cs) {
|
||||||
strncpy (cs->name, name, sizeof (cs->name));
|
memccpy (cs->name, name, 0, sizeof (cs->name));
|
||||||
c->data = (void *) (cs + 1);
|
c->data = (void *) (cs + 1);
|
||||||
cs->user = c;
|
cs->user = c;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue