summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/dict.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/dict.c')
-rw-r--r--libglusterfs/src/dict.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 6f7adb51589..96cb9e94bda 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -473,6 +473,26 @@ dict_get (dict_t *this, char *key)
return NULL;
}
+int
+dict_key_count (dict_t *this)
+{
+ int ret = -1;
+
+ if (!this) {
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict passed is NULL");
+ return ret;
+ }
+
+ LOCK (&this->lock);
+ {
+ ret = this->count;
+ }
+ UNLOCK (&this->lock);
+
+ return ret;
+}
+
void
dict_del (dict_t *this, char *key)
{