diff options
| author | 2010-03-16 03:04:17 +0100 | |
|---|---|---|
| committer | 2010-03-16 03:04:17 +0100 | |
| commit | 704b112c38a68f021f8e98cafaf1a60257ea8c80 (patch) | |
| tree | 7bfe44ba3c558d27670e4a85f0f9c13d2786e1bc /src/afc.c | |
| parent | 36048ded8efda588a20b5cf284670a984f7cc650 (diff) | |
| download | libimobiledevice-704b112c38a68f021f8e98cafaf1a60257ea8c80.tar.gz libimobiledevice-704b112c38a68f021f8e98cafaf1a60257ea8c80.tar.bz2 | |
Document internal make_strings_list() and change parameter names
Diffstat (limited to 'src/afc.c')
| -rw-r--r-- | src/afc.c | 16 |
1 files changed, 13 insertions, 3 deletions
| @@ -383,15 +383,25 @@ static uint32_t count_nullspaces(char *string, uint32_t number) | |||
| 383 | return nulls; | 383 | return nulls; |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | static char **make_strings_list(char *tokens, uint32_t true_length) | 386 | /** |
| 387 | * Splits a string of tokens by null characters and returns each token in a | ||
| 388 | * char array/list. | ||
| 389 | * | ||
| 390 | * @param tokens The characters to split into a list. | ||
| 391 | * @param length The length of the tokens string. | ||
| 392 | * | ||
| 393 | * @return A char ** list with each token found in the string. The caller is | ||
| 394 | * responsible for freeing the memory. | ||
| 395 | */ | ||
| 396 | static char **make_strings_list(char *tokens, uint32_t length) | ||
| 387 | { | 397 | { |
| 388 | uint32_t nulls = 0, i = 0, j = 0; | 398 | uint32_t nulls = 0, i = 0, j = 0; |
| 389 | char **list = NULL; | 399 | char **list = NULL; |
| 390 | 400 | ||
| 391 | if (!tokens || !true_length) | 401 | if (!tokens || !length) |
| 392 | return NULL; | 402 | return NULL; |
| 393 | 403 | ||
| 394 | nulls = count_nullspaces(tokens, true_length); | 404 | nulls = count_nullspaces(tokens, length); |
| 395 | list = (char **) malloc(sizeof(char *) * (nulls + 1)); | 405 | list = (char **) malloc(sizeof(char *) * (nulls + 1)); |
| 396 | for (i = 0; i < nulls; i++) { | 406 | for (i = 0; i < nulls; i++) { |
| 397 | list[i] = strdup(tokens + j); | 407 | list[i] = strdup(tokens + j); |
