Browse Source

use G_N_ELEMENTS from glib instead of ARRAY_SIZE

git.mgm/mediaproxy-ng/2.0
Richard Fuchs 15 years ago
parent
commit
c7635d4365
5 changed files with 4 additions and 5 deletions
  1. +1
    -1
      daemon/aux.c
  2. +0
    -1
      daemon/aux.h
  3. +1
    -1
      daemon/call.c
  4. +1
    -1
      daemon/control.c
  5. +1
    -1
      daemon/control_udp.c

+ 1
- 1
daemon/aux.c View File

@ -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]);


+ 0
- 1
daemon/aux.h View File

@ -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"


+ 1
- 1
daemon/call.c View File

@ -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";


+ 1
- 1
daemon/control.c View File

@ -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;


+ 1
- 1
daemon/control_udp.c View File

@ -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;


Loading…
Cancel
Save