[PATCH 2/4] Add ohm_conf_keys_length method
Rob Taylor
rob.taylor at codethink.co.uk
Thu Aug 9 06:17:41 PDT 2007
Adds ohm_conf_keys_length method to OhmConf to return the number of keys stored.
---
ohmd/ohm-conf.c | 11 ++++++++---
ohmd/ohm-conf.h | 2 ++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/ohmd/ohm-conf.c b/ohmd/ohm-conf.c
index ce0448d..b36259b 100644
--- a/ohmd/ohm-conf.c
+++ b/ohmd/ohm-conf.c
@@ -209,14 +209,19 @@ foreach_keys (gpointer key,
}
void
-ohm_conf_keys_foreach(OhmConf *conf,
- OhmConfForeachFunc func,
- gpointer user_data)
+ohm_conf_keys_foreach (OhmConf *conf,
+ OhmConfForeachFunc func,
+ gpointer user_data)
{
ForeachData d = {func, user_data};
g_hash_table_foreach (conf->priv->keys, foreach_keys, &d);
}
+gint
+ohm_conf_keys_length (OhmConf *conf)
+{
+ return g_hash_table_size(conf->priv->keys);
+}
/**
* ohm_conf_set_key:
diff --git a/ohmd/ohm-conf.h b/ohmd/ohm-conf.h
index 1345899..33cd06f 100644
--- a/ohmd/ohm-conf.h
+++ b/ohmd/ohm-conf.h
@@ -72,6 +72,8 @@ void ohm_conf_keys_foreach (OhmConf *conf,
OhmConfForeachFunc func,
gpointer user_data);
+gint ohm_conf_keys_length (OhmConf *conf);
+
gboolean ohm_conf_set_key_internal (OhmConf *conf,
const gchar *key,
gint value,
--
1.5.3.GIT
--------------060201080106070404000602
Content-Type: text/x-patch;
name*0="0003-covert-OhmKeystore-to-use-new-OhmCOnf-key-iterator.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0003-covert-OhmKeystore-to-use-new-OhmCOnf-key-iterator.patc";
filename*1="h"
More information about the Ohm-devel
mailing list