[pulseaudio-discuss] [PATCH v7 01/33] pulsecore: Add pa_strneq macro

Hajime Fujita crisp.fujita at gmail.com
Sun Nov 6 18:53:55 UTC 2016

From: Hajime Fujita <crisp.fujita at nifty.com>

This macro compares if the given two strings, with the maximum length
of n, are equal. Useful for strings that are not NULL-terminated.
 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 8847528..be023a8 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) {

More information about the pulseaudio-discuss mailing list