From 9693daaaef1b996d0efc5338cf3707bb6205fee9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 7 Feb 2026 01:10:55 +0100 Subject: [PATCH] *: 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 --- klibc-utils/resume.c | 2 +- networking/ntpd.c | 2 +- shell/ash.c | 2 +- util-linux/volume_id/get_devname.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/klibc-utils/resume.c b/klibc-utils/resume.c index fde5587e2..179413627 100644 --- a/klibc-utils/resume.c +++ b/klibc-utils/resume.c @@ -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, ':'); diff --git a/networking/ntpd.c b/networking/ntpd.c index efe9f5326..595000b11 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -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; diff --git a/shell/ash.c b/shell/ash.c index 2f30857d7..4f824e1b2 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -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; diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index 39155f256..52bb8e03a 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c @@ -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;