summaryrefslogtreecommitdiffstats
path: root/common/eurephia_values.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/eurephia_values.c')
-rw-r--r--common/eurephia_values.c17
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);
}