diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-13 18:23:02 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-13 18:23:02 +0100 |
commit | 41e3fbe0fe12ac194c3ba8b60b39d26e826ad141 (patch) | |
tree | 1c1afc4c2d5921aee6fbb87eea7ec9f6391838db /common/eurephia_values.c | |
parent | f4805d70cc4514b2569f8864ac138b5b21409cbc (diff) | |
download | eurephia-41e3fbe0fe12ac194c3ba8b60b39d26e826ad141.tar.gz eurephia-41e3fbe0fe12ac194c3ba8b60b39d26e826ad141.tar.xz eurephia-41e3fbe0fe12ac194c3ba8b60b39d26e826ad141.zip |
Added a new eurephiaVALUES function: eClear_key_value()
This function clears the contents of a eurephiaVALUES key/value record.
It will not remove the record from the stack, but only free the key and
value pointers and sets them to NULL.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'common/eurephia_values.c')
-rw-r--r-- | common/eurephia_values.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/common/eurephia_values.c b/common/eurephia_values.c index d9f64eb..19fe05d 100644 --- a/common/eurephia_values.c +++ b/common/eurephia_values.c @@ -38,6 +38,20 @@ /** + * Clears the values of a eurephiaVALUES key/value record. + * This function does not remove the record from the stack, but + * only frees the key and value pointers and sets them to NULL. + * + * @param vls Pointer to the eurephiaVALUES record to be cleared + */ +void eClear_key_value(eurephiaVALUES *vls) { + if( vls != NULL ) { + free_nullsafe(NULL, vls->key); + free_nullsafe(NULL, vls->val); + } +} + +/** * Internal function. Makes sure a eurephiaVALUES stack is freed up * * @param vls Pointer to a eurephiaVALUES stack. @@ -46,8 +60,7 @@ void do_free_vals(eurephiaVALUES *vls) { if( vls->next != NULL ) { do_free_vals(vls->next); } - free_nullsafe(NULL, vls->key); - free_nullsafe(NULL, vls->val); + eClear_key_value(vls); free_nullsafe(NULL, vls); } |