get rid of FLAG_DEFAULT and juggle some params

This commit is contained in:
Anthony Minessale 2016-12-15 15:39:36 -06:00 committed by Mike Jerris
parent ec0906e2d4
commit a0e3c93b09
2 changed files with 8 additions and 11 deletions

View File

@ -90,16 +90,17 @@ typedef enum {
typedef enum { typedef enum {
KS_HASH_FLAG_NONE = 0, KS_HASH_FLAG_MUTEX = 0,
KS_HASH_FLAG_DEFAULT = (1 << 0), KS_HASH_FLAG_FREE_KEY = (1 << 0),
KS_HASH_FLAG_FREE_KEY = (1 << 1), KS_HASH_FLAG_FREE_VALUE = (1 << 1),
KS_HASH_FLAG_FREE_VALUE = (1 << 2), KS_HASH_FLAG_RWLOCK = (1 << 2),
KS_HASH_FLAG_RWLOCK = (1 << 3), KS_HASH_FLAG_DUP_CHECK = (1 << 3),
KS_HASH_FLAG_DUP_CHECK = (1 << 4), KS_HASH_FLAG_NOLOCK = (1 << 4)
KS_HASH_FLAG_NOLOCK = (1 << 5)
} ks_hash_flag_t; } ks_hash_flag_t;
#define KS_HASH_FREE_BOTH KS_HASH_FLAG_FREE_KEY | KS_HASH_FLAG_FREE_VALUE #define KS_HASH_FREE_BOTH KS_HASH_FLAG_FREE_KEY | KS_HASH_FLAG_FREE_VALUE
#define KS_HASH_FLAG_NONE KS_HASH_FLAG_MUTEX
typedef enum { typedef enum {
KS_HASH_MODE_DEFAULT = 0, KS_HASH_MODE_DEFAULT = 0,

View File

@ -210,10 +210,6 @@ ks_hash_create_ex(ks_hash_t **hp, unsigned int minsize,
break; break;
} }
if (flags == KS_HASH_FLAG_DEFAULT) {
flags = KS_HASH_FLAG_FREE_KEY | KS_HASH_FLAG_DUP_CHECK | KS_HASH_FLAG_NOLOCK;
}
if ((flags & KS_HASH_FLAG_NOLOCK)) { if ((flags & KS_HASH_FLAG_NOLOCK)) {
flags &= ~KS_HASH_FLAG_RWLOCK; flags &= ~KS_HASH_FLAG_RWLOCK;
} }