diff options
| author | 2013-04-25 16:25:22 +0100 | |
|---|---|---|
| committer | 2013-04-25 16:25:22 +0100 | |
| commit | 8ae2368031ac51065b569003209aae267b95d5b2 (patch) | |
| tree | 13befd2c16f6de15be09d826f45e5338ab06a54a | |
| parent | b2924a1549d874fb86deaad5fd2438e567c65bf4 (diff) | |
| download | libimobiledevice-8ae2368031ac51065b569003209aae267b95d5b2.tar.gz libimobiledevice-8ae2368031ac51065b569003209aae267b95d5b2.tar.bz2 | |
afc: Add convenience helper to free AFC dictionaries in afc_dictionary_free()
| -rw-r--r-- | include/libimobiledevice/afc.h | 1 | ||||
| -rw-r--r-- | src/afc.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h index d262650..faf1b10 100644 --- a/include/libimobiledevice/afc.h +++ b/include/libimobiledevice/afc.h | |||
| @@ -115,6 +115,7 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt | |||
| 115 | 115 | ||
| 116 | /* Helper functions */ | 116 | /* Helper functions */ |
| 117 | afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value); | 117 | afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value); |
| 118 | afc_error_t afc_dictionary_free(char **dictionary); | ||
| 118 | 119 | ||
| 119 | #ifdef __cplusplus | 120 | #ifdef __cplusplus |
| 120 | } | 121 | } |
| @@ -1349,3 +1349,17 @@ afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mt | |||
| 1349 | return ret; | 1349 | return ret; |
| 1350 | } | 1350 | } |
| 1351 | 1351 | ||
| 1352 | afc_error_t afc_dictionary_free(char **dictionary) | ||
| 1353 | { | ||
| 1354 | int i = 0; | ||
| 1355 | |||
| 1356 | if (!dictionary) | ||
| 1357 | return AFC_E_INVALID_ARG; | ||
| 1358 | |||
| 1359 | for (i = 0; dictionary[i]; i++) { | ||
| 1360 | free(dictionary[i]); | ||
| 1361 | } | ||
| 1362 | free(dictionary); | ||
| 1363 | |||
| 1364 | return AFC_E_SUCCESS; | ||
| 1365 | } | ||
