*: use is_prefixed_with() where appropriate

function                                             old     new   delta
resume_main                                          560     556      -4
uuidcache_check_device                               107     101      -6
ntp_init                                            1005     997      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-18)             Total: -18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2026-02-07 01:10:55 +01:00
parent 79d35b5a0e
commit 9693daaaef
4 changed files with 4 additions and 4 deletions

View file

@ -39,7 +39,7 @@ static dev_t name_to_dev_t(const char *devname)
struct stat st;
int r;
if (strncmp(devname, "/dev/", 5) != 0) {
if (!is_prefixed_with(devname, "/dev/")) {
char *cptr;
cptr = strchr(devname, ':');

View file

@ -2395,7 +2395,7 @@ static NOINLINE void ntp_init(char **argv)
while (peers) {
char *peer = llist_pop(&peers);
key_entry_t *key_entry = NULL;
if (strncmp(peer, "keyno:", 6) == 0) {
if (is_prefixed_with(peer, "keyno:")) {
char *end;
int key_id;
peer += 6;

View file

@ -1149,7 +1149,7 @@ static void dbg_show_dirtymem(const char *msg)
p = buf;
for (;;) {
char *e = strchrnul(p, '\n');
if (strncmp(p, "Private_Dirty:", 14) == 0) {
if (is_prefixed_with(p, "Private_Dirty:")) {
p = skip_whitespace(p + 14);
bb_error_msg("%s:%.*s", msg, (int)(e - p), p);
break;

View file

@ -110,7 +110,7 @@ uuidcache_check_device(struct recursive_state *state UNUSED_PARAM,
/* note: this check rejects links to devices, among other nodes */
if (!S_ISBLK(statbuf->st_mode)
#if ENABLE_FEATURE_VOLUMEID_UBIFS
&& !(S_ISCHR(statbuf->st_mode) && strncmp(bb_basename(device), "ubi", 3) == 0)
&& !(S_ISCHR(statbuf->st_mode) && is_prefixed_with(bb_basename(device), "ubi"))
#endif
)
return TRUE;