summaryrefslogtreecommitdiff
path: root/json.c
diff options
context:
space:
mode:
authorZbigniew Chyla <zbigniew.chyla@nsn.com>2015-01-16 15:46:59 +0100
committerEric S. Raymond <esr@thyrsus.com>2015-01-21 10:47:00 -0500
commitd0174ca4e78831bbdd798d02a481ba2569425722 (patch)
tree3bcdd83bb0e0fabcbc2e1e8e84c7befffc19c3cc /json.c
parent39554efdf0416e35236ad3d23a3a893d90c68be6 (diff)
downloadgpsd-d0174ca4e78831bbdd798d02a481ba2569425722.tar.gz
Add str_starts_with macro, use it instead of strncmp.
This change doesn't affect generated binary code.
Diffstat (limited to 'json.c')
-rw-r--r--json.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/json.c b/json.c
index f208e747..4ba5173e 100644
--- a/json.c
+++ b/json.c
@@ -686,11 +686,11 @@ int json_read_array(const char *cp, const struct json_array_t *arr,
#endif /* JSON_MINIMAL */
case t_boolean:
#ifndef JSON_MINIMAL
- if (strncmp(cp, "true", 4) == 0) {
+ if (str_starts_with(cp, "true")) {
arr->arr.booleans.store[offset] = true;
cp += 4;
}
- else if (strncmp(cp, "false", 5) == 0) {
+ else if (str_starts_with(cp, "false")) {
arr->arr.booleans.store[offset] = false;
cp += 5;
}