diff --git a/daemon/aux.c b/daemon/aux.c index ed98ac1e3..53fd2ec4e 100644 --- a/daemon/aux.c +++ b/daemon/aux.c @@ -107,7 +107,7 @@ GQueue *pcre_multi_match(pcre **re, pcre_extra **ree, const char *rex, const cha q = g_queue_new(); el = malloc(sizeof(*el) * num); - for (start = 0, len = strlen(s); pcre_exec(*re, *ree, s + start, len - start, 0, 0, ovec, ARRAY_SIZE(ovec)) > 0; start += ovec[1]) { + for (start = 0, len = strlen(s); pcre_exec(*re, *ree, s + start, len - start, 0, 0, ovec, G_N_ELEMENTS(ovec)) > 0; start += ovec[1]) { for (i = 0; i < num; i++) { ov = ovec + 2 + i*2; el[i] = (ov[0] == -1) ? NULL : g_strndup(s + start + ov[0], ov[1] - ov[0]); diff --git a/daemon/aux.h b/daemon/aux.h index 593d82069..173b9fa9e 100644 --- a/daemon/aux.h +++ b/daemon/aux.h @@ -17,7 +17,6 @@ #define OFFSET_OF(t,e) ((unsigned int) (unsigned long) &(((t *) 0)->e)) -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) #define ZERO(x) memset(&(x), 0, sizeof(x)) #define IPF "%u.%u.%u.%u" diff --git a/daemon/call.c b/daemon/call.c index e5e12751b..7ff8a9f4a 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -172,7 +172,7 @@ static int stream_packet(struct streamrelay *r, char *b, int l, struct sockaddr_ if (!pe->codec) { cc = b[1]; cc &= 0x7f; - if (cc < ARRAY_SIZE(rtp_codecs)) + if (cc < G_N_ELEMENTS(rtp_codecs)) pe->codec = rtp_codecs[cc] ? : "unknown"; else pe->codec = "unknown"; diff --git a/daemon/control.c b/daemon/control.c index da5e1398e..82249eeb8 100644 --- a/daemon/control.c +++ b/daemon/control.c @@ -68,7 +68,7 @@ static int control_stream_parse(struct control_stream *s, char *line) { parse_ree = pcre_study(parse_re, 0, &errptr); } - ret = pcre_exec(parse_re, parse_ree, line, strlen(line), 0, 0, ovec, ARRAY_SIZE(ovec)); + ret = pcre_exec(parse_re, parse_ree, line, strlen(line), 0, 0, ovec, G_N_ELEMENTS(ovec)); if (ret <= 0) { mylog(LOG_WARNING, "Unable to parse command line from " DF ": %s", DP(s->inaddr), line); return -1; diff --git a/daemon/control_udp.c b/daemon/control_udp.c index c21fc40da..6f2d8d2d4 100644 --- a/daemon/control_udp.c +++ b/daemon/control_udp.c @@ -58,7 +58,7 @@ static void control_udp_incoming(int fd, void *p) { parse_ree = pcre_study(parse_re, 0, &errptr); } - ret = pcre_exec(parse_re, parse_ree, buf, ret, 0, 0, ovec, ARRAY_SIZE(ovec)); + ret = pcre_exec(parse_re, parse_ree, buf, ret, 0, 0, ovec, G_N_ELEMENTS(ovec)); if (ret <= 0) { mylog(LOG_WARNING, "Unable to parse command line from udp:" DF ": %s", DP(sin), buf); return;