summaryrefslogtreecommitdiffstats
path: root/pw/pw_group.c
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2015-08-03 22:07:50 +0000
committerEd Schouten <ed@FreeBSD.org>2015-08-03 22:07:50 +0000
commit966e71ed139757f586bc1136032dfcc52b454d71 (patch)
tree20844a839d1489805dd3d7065569ab8fb11f7b95 /pw/pw_group.c
parente6bc8c13d09e362b41776ea638ac59673726a395 (diff)
downloadpw-darwin-966e71ed139757f586bc1136032dfcc52b454d71.tar.gz
pw-darwin-966e71ed139757f586bc1136032dfcc52b454d71.tar.zst
pw-darwin-966e71ed139757f586bc1136032dfcc52b454d71.zip
Avoid calling strlen() where we can use the strspn() return value.
Diffstat (limited to 'pw/pw_group.c')
-rw-r--r--pw/pw_group.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pw/pw_group.c b/pw/pw_group.c
index df2d76d..711ef68 100644
--- a/pw/pw_group.c
+++ b/pw/pw_group.c
@@ -297,7 +297,7 @@ pw_group_show(int argc, char **argv, char *arg1)
};
if (arg1 != NULL) {
- if (strspn(arg1, "0123456789") == strlen(arg1))
+ if (arg1[strspn(arg1, "0123456789")] == '\0')
id = pw_checkid(arg1, GID_MAX);
else
name = arg1;
@@ -360,7 +360,7 @@ pw_group_del(int argc, char **argv, char *arg1)
bool nis = false;
if (arg1 != NULL) {
- if (strspn(arg1, "0123456789") == strlen(arg1))
+ if (arg1[strspn(arg1, "0123456789")] == '\0')
id = pw_checkid(arg1, GID_MAX);
else
name = arg1;
@@ -491,7 +491,7 @@ pw_group_add(int argc, char **argv, char *arg1)
quiet = precrypted = dryrun = pretty = nis = false;
if (arg1 != NULL) {
- if (strspn(arg1, "0123456789") == strlen(arg1))
+ if (arg1[strspn(arg1, "0123456789")] == '\0')
id = pw_checkid(arg1, GID_MAX);
else
name = arg1;
@@ -577,7 +577,7 @@ pw_group_mod(int argc, char **argv, char *arg1)
quiet = pretty = dryrun = nis = precrypted = false;
if (arg1 != NULL) {
- if (strspn(arg1, "0123456789") == strlen(arg1))
+ if (arg1[strspn(arg1, "0123456789")] == '\0')
id = pw_checkid(arg1, GID_MAX);
else
name = arg1;