ubusd_event: move strmatch_len to ubus_common.h
[project/ubus.git] / ubus_common.h
index 4bb992793d5f9921074721118f3412471d2995cd..5e4d0ad94f8f11d242ac9e7948f445e727cb20b6 100644 (file)
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #endif
 
+static inline bool ubus_strmatch_len(const char *s1, const char *s2, int *len)
+{
+       for (*len = 0; s1[*len] == s2[*len]; (*len)++)
+               if (!s1[*len])
+                       return true;
+
+       return false;
+}
+
 #endif