summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-10-03 15:36:15 +0200
committerHans Dedecker <dedeckeh@gmail.com>2018-10-06 20:39:03 +0200
commit73bd84748f0186893e3ea2cf66c22fed9557ee88 (patch)
treeb16f38b091f6400b54aeb9b009291838fae8f9bb
parent0327a91bebad00fc9a1132bc9b012c185444197c (diff)
downloadubus-73bd84748f0186893e3ea2cf66c22fed9557ee88.tar.gz
ubusd_event: move strmatch_len to ubus_common.h
Rename strmatch_len into ubus_strmatch_len and move it to ubus_common.h Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--ubus_common.h9
-rw-r--r--ubusd_event.c11
2 files changed, 10 insertions, 10 deletions
diff --git a/ubus_common.h b/ubus_common.h
index 4bb9927..5e4d0ad 100644
--- a/ubus_common.h
+++ b/ubus_common.h
@@ -21,4 +21,13 @@
#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
diff --git a/ubusd_event.c b/ubusd_event.c
index 0469c20..f07f826 100644
--- a/ubusd_event.c
+++ b/ubusd_event.c
@@ -132,15 +132,6 @@ static void ubusd_send_event_msg(struct ubus_msg_buf **ub, struct ubus_client *c
ubus_msg_send(obj->client, *ub);
}
-static bool 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;
-}
-
int ubusd_send_event(struct ubus_client *cl, const char *id,
event_fill_cb fill_cb, void *cb_priv)
{
@@ -160,7 +151,7 @@ int ubusd_send_event(struct ubus_client *cl, const char *id,
int cur_match_len;
bool full_match;
- full_match = strmatch_len(id, key, &cur_match_len);
+ full_match = ubus_strmatch_len(id, key, &cur_match_len);
if (cur_match_len < match_len)
break;