summaryrefslogtreecommitdiff
path: root/src/print_path_exists.c
diff options
context:
space:
mode:
authorMats <d912e3@gmail.com>2014-03-11 20:15:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2014-03-12 08:28:16 +0100
commit4f7da73885934a052425fc71861b0c9922c2122f (patch)
treef3872ee680309fa8955318f4d3a586cb08846a9d /src/print_path_exists.c
parent52814295a0b3a0785631256e9e2dc6b8139e2be8 (diff)
Unify use of string comparisons
* strncmp(s1, s2, strlen(s2)) → BEGINS_WITH(s1, s2) * strncmp(s1, s2, strlen(s1)) → strcmp(s1, s2) * Prefer case-insensitive comparison for options
Diffstat (limited to 'src/print_path_exists.c')
-rw-r--r--src/print_path_exists.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/print_path_exists.c b/src/print_path_exists.c
index c5225a1..a2fcb14 100644
--- a/src/print_path_exists.c
+++ b/src/print_path_exists.c
@@ -21,10 +21,10 @@ void print_path_exists(yajl_gen json_gen, char *buffer, const char *title, const
continue;
}
- if (strncmp(walk+1, "title", strlen("title")) == 0) {
+ if (BEGINS_WITH(walk+1, "title")) {
outwalk += sprintf(outwalk, "%s", title);
walk += strlen("title");
- } else if (strncmp(walk+1, "status", strlen("status")) == 0) {
+ } else if (BEGINS_WITH(walk+1, "status")) {
outwalk += sprintf(outwalk, "%s", (exists ? "yes" : "no"));
walk += strlen("status");
}