| 48 | } |
| 49 | |
| 50 | static int kwsysSystem__AppendArgument(char** local, char*** begin, |
| 51 | char*** end, int* size, char* arg_local, |
| 52 | char** arg_begin, char** arg_end, |
| 53 | int* arg_size) |
| 54 | { |
| 55 | /* Append a null-terminator to the argument string. */ |
| 56 | if (!kwsysSystem__AppendByte(arg_local, arg_begin, arg_end, arg_size, |
| 57 | '\0')) { |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | /* Allocate space for the argument pointer. */ |
| 62 | if ((*end - *begin) >= *size) { |
| 63 | kwsysSystem_ptrdiff_t length = *end - *begin; |
| 64 | char** newPointers = (char**)malloc((size_t)(*size) * 2 * sizeof(char*)); |
| 65 | if (!newPointers) { |
| 66 | return 0; |
| 67 | } |
| 68 | memcpy(newPointers, *begin, (size_t)(length) * sizeof(char*)); |
| 69 | if (*begin != local) { |
| 70 | free(*begin); |
| 71 | } |
| 72 | *begin = newPointers; |
| 73 | *end = *begin + length; |
| 74 | *size *= 2; |
| 75 | } |
| 76 | |
| 77 | /* Allocate space for the argument string. */ |
| 78 | **end = (char*)malloc((size_t)(*arg_end - *arg_begin)); |
| 79 | if (!**end) { |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | /* Store the argument in the command array. */ |
| 84 | memcpy(**end, *arg_begin, (size_t)(*arg_end - *arg_begin)); |
| 85 | ++(*end); |
| 86 | |
| 87 | /* Reset the argument to be empty. */ |
| 88 | *arg_end = *arg_begin; |
| 89 | |
| 90 | return 1; |
| 91 | } |
| 92 | |
| 93 | #define KWSYSPE_LOCAL_BYTE_COUNT 1024 |
| 94 | #define KWSYSPE_LOCAL_ARGS_COUNT 32 |
no test coverage detected
searching dependent graphs…