aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-21 15:30:40 +0000
committerRoy Marples <roy@marples.name>2008-01-21 15:30:40 +0000
commit07728abbc1eb1aa91d21318f3a3d64b15c2800fe (patch)
tree350dfce5968e05b1db4a1b7d94cb72dfdf830df4 /src
parent847ccac13c8afc04d1105cc483c8ec7e9baa53a6 (diff)
Checking first char for null is more efficient than strlen.
Diffstat (limited to 'src')
-rw-r--r--src/librc/librc-depend.c4
-rw-r--r--src/librc/librc-misc.c2
-rw-r--r--src/rc/rc-applets.c6
-rw-r--r--src/rc/rc.c2
-rw-r--r--src/rc/start-stop-daemon.c2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c
index 4ccd7ee2..c6ebf495 100644
--- a/src/librc/librc-depend.c
+++ b/src/librc/librc-depend.c
@@ -151,7 +151,7 @@ rc_depinfo_t *rc_deptree_load (void)
{
/* Sanity */
e = get_shell_value (p);
- if (! e || strlen (e) == 0)
+ if (! e || *e == '\0')
goto next;
if (! deptree)
@@ -176,7 +176,7 @@ rc_depinfo_t *rc_deptree_load (void)
/* Sanity */
e = get_shell_value (p);
- if (! e || strlen (e) == 0)
+ if (! e || *e == '\0')
goto next;
if (! deptype)
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index be911e9f..db6209fd 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -196,7 +196,7 @@ char **rc_config_load (const char *file)
do {
/* Bash variables are usually quoted */
token = strsep (&line, "\"\'");
- } while ((token) && (strlen (token) == 0));
+ } while (token && *token == '\0');
/* Drop a newline if that's all we have */
if (token) {
diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c
index 80e55aad..fc362a28 100644
--- a/src/rc/rc-applets.c
+++ b/src/rc/rc-applets.c
@@ -205,7 +205,7 @@ static int do_service (int argc, char **argv)
else
service = getenv ("SVCNAME");
- if (! service || strlen (service) == 0)
+ if (! service || *service == '\0')
eerrorx ("%s: no service specified", applet);
if (strcmp (applet, "service_started") == 0)
@@ -252,7 +252,7 @@ static int do_mark_service (int argc, char **argv)
else
service = getenv ("SVCNAME");
- if (! service || strlen (service) == 0)
+ if (! service || *service == '\0')
eerrorx ("%s: no service specified", applet);
if (strcmp (applet, "mark_service_started") == 0)
@@ -310,7 +310,7 @@ static int do_value (int argc, char **argv)
if (! service)
eerrorx ("%s: no service specified", applet);
- if (argc < 2 || ! argv[1] || strlen (argv[1]) == 0)
+ if (argc < 2 || ! argv[1] || *argv[1] == '\0')
eerrorx ("%s: no option specified", applet);
if (strcmp (applet, "service_get_value") == 0 ||
diff --git a/src/rc/rc.c b/src/rc/rc.c
index e6884154..1ee7330a 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -634,7 +634,7 @@ int main (int argc, char **argv)
{
switch (opt) {
case 'o':
- if (strlen (optarg) == 0)
+ if (*optarg == '\0')
optarg = NULL;
exit (set_ksoftlevel (optarg) ? EXIT_SUCCESS : EXIT_FAILURE);
case_RC_COMMON_GETOPT
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index 045080ea..c2293e4e 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -152,7 +152,7 @@ static int parse_signal (const char *sig)
unsigned int i = 0;
char *s;
- if (! sig || strlen (sig) == 0)
+ if (! sig || *sig == '\0')
return (-1);
if (sscanf (sig, "%u", &i) == 1) {