diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-18 08:57:51 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-18 08:57:51 +0200 |
commit | 9b72a7e795d74e4dceec516d592609de12b69e85 (patch) | |
tree | 899f5a0a6e455969ab367caf76205e25c87c39f9 /src/libmdsserver/fd-table.c | |
parent | m (diff) | |
download | mds-9b72a7e795d74e4dceec516d592609de12b69e85.tar.gz mds-9b72a7e795d74e4dceec516d592609de12b69e85.tar.bz2 mds-9b72a7e795d74e4dceec516d592609de12b69e85.tar.xz |
reduce code complexity
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/fd-table.c')
-rw-r--r-- | src/libmdsserver/fd-table.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libmdsserver/fd-table.c b/src/libmdsserver/fd-table.c index eb681f9..0852eb6 100644 --- a/src/libmdsserver/fd-table.c +++ b/src/libmdsserver/fd-table.c @@ -161,8 +161,7 @@ size_t fd_table_put(fd_table_t* restrict this, int key, size_t value) { size_t* old_values = this->values; size_t old_bitcap, new_bitcap; - this->values = realloc(this->values, (this->capacity << 1) * sizeof(size_t)); - if (this->values == NULL) + if (xrealloc(this->values, this->capacity << 1, size_t)) { this->values = old_values; return 0; @@ -177,8 +176,7 @@ size_t fd_table_put(fd_table_t* restrict this, int key, size_t value) if (new_bitcap > old_bitcap) { uint64_t* old_used = this->used; - this->used = realloc(this->used, new_bitcap * sizeof(size_t)); - if (this->used == NULL) + if (xrealloc(this->used, new_bitcap, size_t)) { this->used = old_used; this->capacity >>= 1; |