From 8ae2368031ac51065b569003209aae267b95d5b2 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Thu, 25 Apr 2013 16:25:22 +0100 Subject: afc: Add convenience helper to free AFC dictionaries in afc_dictionary_free() --- src/afc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/afc.c b/src/afc.c index f39562d..f8ca27c 100644 --- a/src/afc.c +++ b/src/afc.c @@ -1349,3 +1349,17 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt return ret; } +afc_error_t afc_dictionary_free(char **dictionary) +{ + int i = 0; + + if (!dictionary) + return AFC_E_INVALID_ARG; + + for (i = 0; dictionary[i]; i++) { + free(dictionary[i]); + } + free(dictionary); + + return AFC_E_SUCCESS; +} -- cgit v1.2.1