aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server/receiving.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-10 02:21:00 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-10 02:21:00 +0100
commit7179f51176e1f3af53694e09d7ea2ca602403cf1 (patch)
treedb24424529090c7ac819e2ec9724c855dbb2d53e /src/mds-server/receiving.c
parenttypo (diff)
downloadmds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.gz
mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.bz2
mds-7179f51176e1f3af53694e09d7ea2ca602403cf1.tar.xz
no more direct allocations, always use macros, unless using alloca
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-server/receiving.c')
-rw-r--r--src/mds-server/receiving.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mds-server/receiving.c b/src/mds-server/receiving.c
index 8571944..bc22fe2 100644
--- a/src/mds-server/receiving.c
+++ b/src/mds-server/receiving.c
@@ -82,10 +82,7 @@ static int modifying_notify(client_t* client, mds_message_t message, uint64_t mo
memcpy(multicast->payload, message.payload, message.payload_size * sizeof(char));
fail_if (xmalloc(multicast->headers, message.header_count, char*));
for (i = 0; i < message.header_count; i++, multicast->header_count++)
- {
- multicast->headers[i] = strdup(message.headers[i]);
- fail_if (multicast->headers[i] == NULL);
- }
+ fail_if (xstrdup(multicast->headers[i], message.headers[i]));
done:
pthread_mutex_unlock(&(modify_mutex));
with_mutex (client->modify_mutex, pthread_cond_signal(&(client->modify_cond)););
@@ -199,8 +196,7 @@ static int assign_and_send_id(client_t* client, const char* message_id)
n = strlen(msgbuf);
/* Multicast the reply. */
- msgbuf_ = strdup(msgbuf);
- fail_if (msgbuf_ == NULL);
+ fail_if (xstrdup(msgbuf_, msgbuf));
queue_message_multicast(msgbuf_, n, client);
/* Queue message to be sent when this function returns.
@@ -317,7 +313,7 @@ int message_received(client_t* client)
/* Multicast the message. */
n = mds_message_compose_size(&message);
- fail_if ((msgbuf = malloc(n)) == NULL);
+ fail_if (xbmalloc(msgbuf, n));
mds_message_compose(&message, msgbuf);
queue_message_multicast(msgbuf, n / sizeof(char), client);
msgbuf = NULL;