diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-04-10 15:48:59 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-04-12 16:20:55 +0200 |
commit | ca2d37841476e6272c9957c3f5a0cbe869a531ca (patch) | |
tree | ab1dea346bd6342248858be26e9638437141a0d1 /src/journal/journal-remote.c | |
parent | networkd: link - require both RUNNING and LOWER_UP before using link (diff) | |
download | systemd-ca2d37841476e6272c9957c3f5a0cbe869a531ca.tar.xz systemd-ca2d37841476e6272c9957c3f5a0cbe869a531ca.zip |
Unify GREEDY_REALLOC and GREEDY_REALLOC_T
greedy_realloc() and greedy_realloc0() now store the allocated
size as the count, not bytes.
Replace GREEDY_REALLOC uses with GREEDY_REALLOC_T everywhere,
and then rename GREEDY_REALLOC_T to GREEDY_REALLOC. It is just
too error-prone to have two slightly different macros which do the
same thing.
Diffstat (limited to 'src/journal/journal-remote.c')
-rw-r--r-- | src/journal/journal-remote.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/journal/journal-remote.c b/src/journal/journal-remote.c index 4ece14ee77..794298fe6f 100644 --- a/src/journal/journal-remote.c +++ b/src/journal/journal-remote.c @@ -226,8 +226,8 @@ typedef struct MHDDaemonWrapper { typedef struct RemoteServer { RemoteSource **sources; - ssize_t sources_size; - ssize_t active; + size_t sources_size; + size_t active; sd_event *events; sd_event_source *sigterm_event, *sigint_event, *listen_event; @@ -257,7 +257,7 @@ static int get_source_for_fd(RemoteServer *s, int fd, RemoteSource **source) { assert(fd >= 0); assert(source); - if (!GREEDY_REALLOC0_T(s->sources, s->sources_size, fd + 1)) + if (!GREEDY_REALLOC0(s->sources, s->sources_size, fd + 1)) return log_oom(); if (s->sources[fd] == NULL) { @@ -276,8 +276,7 @@ static int remove_source(RemoteServer *s, int fd) { RemoteSource *source; assert(s); - assert(fd >= 0); - assert(fd < s->sources_size); + assert(fd >= 0 && fd < (ssize_t) s->sources_size); source = s->sources[fd]; if (source) { @@ -837,7 +836,7 @@ static int remoteserver_init(RemoteServer *s) { static int server_destroy(RemoteServer *s) { int r; - ssize_t i; + size_t i; MHDDaemonWrapper *d; r = writer_close(&s->writer); @@ -879,7 +878,7 @@ static int dispatch_raw_source_event(sd_event_source *event, RemoteSource *source; int r; - assert(fd < s->sources_size); + assert(fd >= 0 && fd < (ssize_t) s->sources_size); source = s->sources[fd]; assert(source->fd == fd); |