summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-03-16 03:04:17 +0100
committerGravatar Martin Szulecki2010-03-16 03:04:17 +0100
commit704b112c38a68f021f8e98cafaf1a60257ea8c80 (patch)
tree7bfe44ba3c558d27670e4a85f0f9c13d2786e1bc
parent36048ded8efda588a20b5cf284670a984f7cc650 (diff)
downloadlibimobiledevice-704b112c38a68f021f8e98cafaf1a60257ea8c80.tar.gz
libimobiledevice-704b112c38a68f021f8e98cafaf1a60257ea8c80.tar.bz2
Document internal make_strings_list() and change parameter names
-rw-r--r--src/afc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/afc.c b/src/afc.c
index e2e84e2..e966fa5 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -383,15 +383,25 @@ static uint32_t count_nullspaces(char *string, uint32_t number)
return nulls;
}
-static char **make_strings_list(char *tokens, uint32_t true_length)
+/**
+ * Splits a string of tokens by null characters and returns each token in a
+ * char array/list.
+ *
+ * @param tokens The characters to split into a list.
+ * @param length The length of the tokens string.
+ *
+ * @return A char ** list with each token found in the string. The caller is
+ * responsible for freeing the memory.
+ */
+static char **make_strings_list(char *tokens, uint32_t length)
{
uint32_t nulls = 0, i = 0, j = 0;
char **list = NULL;
- if (!tokens || !true_length)
+ if (!tokens || !length)
return NULL;
- nulls = count_nullspaces(tokens, true_length);
+ nulls = count_nullspaces(tokens, length);
list = (char **) malloc(sizeof(char *) * (nulls + 1));
for (i = 0; i < nulls; i++) {
list[i] = strdup(tokens + j);