forked from len0rd/rockbox
replace strlcpy with strmemccpy
replace applicable calls to strlcpy with calls to strmemccpy which null terminates on truncation in theory the strmemccpy calls should be slightly faster since they don't traverse the rest of the source string on truncation but I seriously doubt there is too much of that going on in the code base Change-Id: Ia0251514e36a6242bbf3f03c5e0df123aba60ed2
This commit is contained in:
parent
b25a9d8f99
commit
f6c719d7ec
43 changed files with 236 additions and 174 deletions
|
@ -23,7 +23,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <string-extra.h>
|
||||
#include "lcd.h"
|
||||
#include "lang.h"
|
||||
#include "menu.h"
|
||||
|
@ -1274,7 +1274,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
|||
{
|
||||
card_name[i] = card_extract_bits(card->cid, (103-8*i), 8);
|
||||
}
|
||||
strlcpy(card_name, card_name, sizeof(card_name));
|
||||
strmemccpy(card_name, card_name, sizeof(card_name));
|
||||
simplelist_addline(
|
||||
"%s Rev %d.%d", card_name,
|
||||
(int) card_extract_bits(card->cid, 63, 4),
|
||||
|
@ -1628,8 +1628,7 @@ static int ata_smart_attr_to_string(
|
|||
slen += len;
|
||||
}
|
||||
|
||||
if (!memccpy (str+slen, buf, '\0', size-slen))
|
||||
(str+slen)[size-slen - 1] = '\0';
|
||||
strmemccpy(str+slen, buf, size-slen);
|
||||
}
|
||||
|
||||
return 1; /* ok */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue