Skip to content
Snippets Groups Projects
Commit 83f7f8ca authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Review fixes.

parent 01526fb2
No related branches found
No related tags found
No related merge requests found
#ifndef TARANTOOL_ASSOC_H_INCLUDED
#define TARANTOOL_ASSOC_H_INCLUDED
/*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
......@@ -106,5 +103,3 @@ mh_strptr_hash(const mh_node_t *a, mh_hash_arg_t arg) {
#define mh_eq_arg_t void *
#define mh_eq(a, b, arg) (lstrcmp(a->key, b->key) == 0)
#include <mhash.h>
#endif /* TARANTOOL_ASSOC_H_INCLUDED */
......@@ -64,12 +64,8 @@
#define mh_ecat(a, b) mh_cat(a, b)
#define _mh(x) mh_ecat(mh_name, x)
#ifndef likely
#define likely(x) __builtin_expect((x),1)
#endif
#ifndef unlikely
#define unlikely(x) __builtin_expect((x),0)
#ifndef mh_unlikely
#define mh_unlikely(x) __builtin_expect((x),0)
#endif
#ifndef MH_TYPEDEFS
......@@ -254,16 +250,16 @@ _mh(put)(struct _mh(t) *h, const mh_node_t *node,
goto put_done;
#if MH_INCREMENTAL_RESIZE
if (unlikely(h->resize_position > 0))
if (mh_unlikely(h->resize_position > 0))
_mh(resize)(h, hash_arg, eq_arg);
else if (unlikely(h->n_dirty >= h->upper_bound)) {
else if (mh_unlikely(h->n_dirty >= h->upper_bound)) {
if (_mh(start_resize)(h, h->n_buckets + 1, 0, hash_arg, eq_arg))
goto put_done;
}
if (h->resize_position)
_mh(put)(h->shadow, node, hash_arg, eq_arg, NULL);
#else
if (unlikely(h->n_dirty >= h->upper_bound)) {
if (mh_unlikely(h->n_dirty >= h->upper_bound)) {
if (_mh(start_resize)(h, h->n_buckets + 1, h->size,
hash_arg, eq_arg))
goto put_done;
......@@ -303,7 +299,7 @@ _mh(del)(struct _mh(t) *h, mh_int_t x,
if (!mh_dirty(h, x))
h->n_dirty--;
#if MH_INCREMENTAL_RESIZE
if (unlikely(h->resize_position))
if (mh_unlikely(h->resize_position))
_mh(del_resize)(h, x, hash_arg, eq_arg);
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment