From e2be9fca9c7a018e1ec42b57ba806bf5df2110fb Mon Sep 17 00:00:00 2001 From: Hajime Fujita Date: Sun, 6 Nov 2016 12:53:55 -0600 Subject: [PATCH] core-util: add pa_strneq macro This macro compares if the given two strings, with the maximum length of n, are equal. Useful for strings that are not NULL-terminated. Reviewed-by: Anton Lundin --- src/pulsecore/core-util.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index 884752821..be023a802 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -219,6 +219,7 @@ void pa_unset_env_recorded(void); bool pa_in_system_mode(void); #define pa_streq(a,b) (!strcmp((a),(b))) +#define pa_strneq(a,b,n) (!strncmp((a),(b),(n))) /* Like pa_streq, but does not blow up on NULL pointers. */ static inline bool pa_safe_streq(const char *a, const char *b) {