summaryrefslogtreecommitdiff
path: root/tern.c
diff options
context:
space:
mode:
Diffstat (limited to 'tern.c')
-rw-r--r--tern.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tern.c b/tern.c
index 96a0985..f61e2aa 100644
--- a/tern.c
+++ b/tern.c
@@ -1,6 +1,6 @@
/*
Copyright 2013 Michael Pavone
- This file is part of BlastEm.
+ This file is part of BlastEm.
BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
*/
#include "tern.h"
@@ -101,13 +101,18 @@ tern_node * tern_insert_int(tern_node * head, char * key, intptr_t value)
return tern_insert(head, key, val);
}
-void * tern_find_ptr(tern_node * head, char * key)
+void * tern_find_ptr_default(tern_node * head, char * key, void * def)
{
tern_val ret;
if (tern_find(head, key, &ret)) {
return ret.ptrval;
}
- return NULL;
+ return def;
+}
+
+void * tern_find_ptr(tern_node * head, char * key)
+{
+ return tern_find_ptr_default(head, key, NULL);
}
tern_node * tern_insert_ptr(tern_node * head, char * key, void * value)