Create an sds array from argv, either as-is or by dequoting every * element. When quoted is non-zero, may return a NULL to indicate an * invalid quoted string. */
| 2032 | * invalid quoted string. |
| 2033 | */ |
| 2034 | static sds *getSdsArrayFromArgv(int argc, char **argv, int quoted) { |
| 2035 | sds *res = sds_malloc(sizeof(sds) * argc); |
| 2036 | |
| 2037 | for (int j = 0; j < argc; j++) { |
| 2038 | if (quoted) { |
| 2039 | sds unquoted = unquoteCString(argv[j]); |
| 2040 | if (!unquoted) { |
| 2041 | while (--j >= 0) sdsfree(res[j]); |
| 2042 | sds_free(res); |
| 2043 | return NULL; |
| 2044 | } |
| 2045 | res[j] = unquoted; |
| 2046 | } else { |
| 2047 | res[j] = sdsnew(argv[j]); |
| 2048 | } |
| 2049 | } |
| 2050 | |
| 2051 | return res; |
| 2052 | } |
| 2053 | |
| 2054 | static int issueCommandRepeat(int argc, char **argv, long repeat) { |
| 2055 | while (1) { |
no test coverage detected