diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-10 02:58:25 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-10 02:58:25 +0100 |
commit | 344273a7e0a6899451836e6072fecebea4a6ac24 (patch) | |
tree | ea24fa9e12ae6dad40eeb6470c92545e14f0f8cf /src/mds-server/interception-condition.c | |
parent | no more direct allocations, always use macros, unless using alloca (diff) | |
download | mds-344273a7e0a6899451836e6072fecebea4a6ac24.tar.gz mds-344273a7e0a6899451836e6072fecebea4a6ac24.tar.bz2 mds-344273a7e0a6899451836e6072fecebea4a6ac24.tar.xz |
add xmemdup macro
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-server/interception-condition.c')
-rw-r--r-- | src/mds-server/interception-condition.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mds-server/interception-condition.c b/src/mds-server/interception-condition.c index 92190af..64d9a10 100644 --- a/src/mds-server/interception-condition.c +++ b/src/mds-server/interception-condition.c @@ -70,10 +70,9 @@ size_t interception_condition_unmarshal(interception_condition_t* restrict this, buf_get_next(data, size_t, this->header_hash); buf_get_next(data, int64_t, this->priority); buf_get_next(data, int, this->modifying); - n = (strlen(data) + 1) * sizeof(char); - fail_if (xbmalloc(this->condition, n)); - memcpy(this->condition, data, n); - return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + n; + n = strlen(data) + 1; + fail_if (xmemdup(this->condition, data, n, char)); + return sizeof(size_t) + sizeof(int64_t) + 2 * sizeof(int) + n * sizeof(char); fail: return 0; } |