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/libmdsserver/fd-table.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 '')
-rw-r--r-- | src/libmdsserver/fd-table.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libmdsserver/fd-table.c b/src/libmdsserver/fd-table.c index 4623825..b5d8f8c 100644 --- a/src/libmdsserver/fd-table.c +++ b/src/libmdsserver/fd-table.c @@ -278,6 +278,7 @@ void fd_table_marshal(const fd_table_t* restrict this, char* restrict data) int fd_table_unmarshal(fd_table_t* restrict this, char* restrict data, remap_func* remapper) { size_t bitcap; + size_t i; /* buf_get(data, int, 0, FD_TABLE_T_VERSION) */ buf_next(data, int, 1); @@ -300,12 +301,9 @@ int fd_table_unmarshal(fd_table_t* restrict this, char* restrict data, remap_fun memcpy(this->used, data, bitcap * sizeof(uint64_t)); if (remapper != NULL) - { - size_t i; - for (i = 0; i < this->capacity; i++) - if (this->used[i / 64] & ((uint64_t)1 << (i % 64))) - this->values[i] = remapper(this->values[i]); - } + for (i = 0; i < this->capacity; i++) + if (this->used[i / 64] & ((uint64_t)1 << (i % 64))) + this->values[i] = remapper(this->values[i]); return 0; fail: |