summaryrefslogtreecommitdiff
path: root/src/common/db.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2012-12-16 17:47:51 -0800
committerBen Longbons <b.r.longbons@gmail.com>2012-12-24 10:02:00 -0800
commitb52127bcbf817ff8285b36d22198b275327e16bb (patch)
tree7bc596289c011e719168bef846b8cf63bf5d4947 /src/common/db.hpp
parent4bd7eeec09629d3c0f900d42c899fe23c69e07b6 (diff)
downloadtmwa-b52127bcbf817ff8285b36d22198b275327e16bb.tar.gz
tmwa-b52127bcbf817ff8285b36d22198b275327e16bb.tar.bz2
tmwa-b52127bcbf817ff8285b36d22198b275327e16bb.tar.xz
tmwa-b52127bcbf817ff8285b36d22198b275327e16bb.zip
Cleanup headers and remove all uses of va_list except logging
Diffstat (limited to 'src/common/db.hpp')
-rw-r--r--src/common/db.hpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/db.hpp b/src/common/db.hpp
index 313ba3a..63ce7fa 100644
--- a/src/common/db.hpp
+++ b/src/common/db.hpp
@@ -3,7 +3,7 @@
#define DB_HPP
# include "sanity.hpp"
-# include <stdarg.h>
+# include <functional>
/// Number of tree roots
// Somewhat arbitrary - larger wastes more space but is faster for large trees
@@ -13,7 +13,7 @@
typedef enum dbn_color
{
RED,
- BLACK
+ BLACK,
} dbn_color;
typedef intptr_t numdb_key_t;
@@ -28,7 +28,7 @@ typedef union db_key_t
} db_key_t;
typedef void* db_val_t;
typedef uint32_t hash_t;
-typedef void(*db_func_t)(db_key_t, db_val_t, va_list);
+typedef std::function<void(db_key_t, db_val_t)> db_func_t;
/// DataBase Node
struct dbn
@@ -82,9 +82,9 @@ struct dbn *db_insert(struct dbt *table, db_key_t key, db_val_t data);
db_val_t db_erase(struct dbt *table, db_key_t key);
/// Execute a function for every element, in unspecified order
-void db_foreach(struct dbt *, db_func_t, ...);
+void db_foreach(struct dbt *, db_func_t);
// opposite of init? Calls release for every element and frees memory
// This probably isn't really needed: we don't have to free memory while exiting
-void db_final(struct dbt *, db_func_t, ...) __attribute__((deprecated));
+void db_final(struct dbt *, db_func_t) __attribute__((deprecated));
-#endif
+#endif // DB_HPP