summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2011-03-22 14:20:33 +0900
committerAkira TAGOH <akira@tagoh.org>2011-03-22 14:20:33 +0900
commit5cfeea47487aee87ede394720998e6e2899ce74c (patch)
tree60fc936f8fa41fd3e60a61bfc0fb92928edb7f50
parentaffd70f95ee0b2e35060b433aceccb6ff4b327b2 (diff)
add hg_dict_clear
-rw-r--r--hieroglyph/hgdict.c21
-rw-r--r--hieroglyph/hgdict.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/hieroglyph/hgdict.c b/hieroglyph/hgdict.c
index 7115bb9..94e6281 100644
--- a/hieroglyph/hgdict.c
+++ b/hieroglyph/hgdict.c
@@ -1105,10 +1105,29 @@ hg_dict_remove(hg_dict_t *dict,
}
/**
+ * hg_dict_clear:
+ * @dict:
+ *
+ * FIXME
+ *
+ * Returns:
+ */
+hg_bool_t
+hg_dict_clear(hg_dict_t *dict)
+{
+ hg_return_val_if_fail (dict != NULL, FALSE, HG_e_typecheck);
+ hg_return_val_if_fail (dict->o.type == HG_TYPE_DICT, FALSE, HG_e_typecheck);
+
+ dict->qroot = Qnil;
+ dict->length = 0;
+
+ return TRUE;
+}
+
+/**
* hg_dict_lookup:
* @dict:
* @qkey:
- * @error:
*
* FIXME
*
diff --git a/hieroglyph/hgdict.h b/hieroglyph/hgdict.h
index fff1597..a0acb28 100644
--- a/hieroglyph/hgdict.h
+++ b/hieroglyph/hgdict.h
@@ -72,6 +72,7 @@ hg_bool_t hg_dict_add (hg_dict_t *dict
hg_bool_t force);
hg_bool_t hg_dict_remove (hg_dict_t *dict,
hg_quark_t qkey);
+hg_bool_t hg_dict_clear (hg_dict_t *dict);
hg_quark_t hg_dict_lookup (hg_dict_t *dict,
hg_quark_t qkey);
hg_usize_t hg_dict_length (hg_dict_t *dict);