mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-20 09:26:37 +00:00
Minor refactor in strn_edup()
This commit is contained in:
parent
1d14f43050
commit
16995f1041
6
mem.c
6
mem.c
@ -51,10 +51,8 @@ void *_emalloc_zero(struct __sourceloc __whence, size_t bytes)
|
||||
char *_strn_edup(struct __sourceloc __whence, const char *str, size_t len)
|
||||
{
|
||||
char *new = _emalloc(__whence, len + 1);
|
||||
if (new) {
|
||||
strncpy(new, str, len);
|
||||
new[len] = '\0';
|
||||
}
|
||||
if (new)
|
||||
strncpy(new, str, len)[len] = '\0';
|
||||
return new;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user