diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-06-14 13:07:33 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-06-14 13:07:33 +0000 |
commit | 028f23ca6f977c2cd0dda6a5fb87e479a92b3511 (patch) | |
tree | 988cc932d0e5111920547bd9df80b5d98a826d07 /src/coucal.c | |
parent | bf40691b62435829f822cea1e54b4c323700c627 (diff) |
Added coucal_get_pvoid() and coucal_get_intptr()
Diffstat (limited to 'src/coucal.c')
-rw-r--r-- | src/coucal.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/coucal.c b/src/coucal.c index 3a81b87..9654431 100644 --- a/src/coucal.c +++ b/src/coucal.c @@ -709,6 +709,14 @@ int coucal_read_pvoid(coucal hashtable, coucal_key_const name, void **pvalue) { return ret; } +void* coucal_get_pvoid(coucal hashtable, coucal_key_const name) { + void *value; + if (!coucal_read_pvoid(hashtable, name, &value)) { + return NULL; + } + return value; +} + int coucal_write_pvoid(coucal hashtable, coucal_key_const name, void *pvalue) { coucal_value value = INTHASH_VALUE_NULL; @@ -1281,6 +1289,14 @@ int coucal_readptr(coucal hashtable, coucal_key_const name, intptr_t * value) { return ret; } +intptr_t coucal_get_intptr(coucal hashtable, coucal_key_const name) { + intptr_t value; + if (!coucal_read(hashtable, name, &value)) { + return 0; + } + return value; +} + coucal coucal_new(size_t initial_size) { coucal hashtable = (coucal) calloc(1, sizeof(struct_coucal)); |