summaryrefslogtreecommitdiff
path: root/strfuncs.h
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 /strfuncs.h
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 'strfuncs.h')
-rw-r--r--strfuncs.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/strfuncs.h b/strfuncs.h
index a196ef23..59371341 100644
--- a/strfuncs.h
+++ b/strfuncs.h
@@ -9,4 +9,7 @@
#include <string.h>
+#define str_starts_with(str, prefix) \
+ (strncmp((str), (prefix), strlen(prefix)) == 0)
+
#endif /* _GPSD_STRFUNCS_H_ */