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. */
| 1844 | * invalid quoted string. |
| 1845 | */ |
| 1846 | static sds *getSdsArrayFromArgv(int argc, char **argv, int quoted) { |
| 1847 | sds *res = sds_malloc(sizeof(sds) * argc); |
| 1848 | |
| 1849 | for (int j = 0; j < argc; j++) { |
| 1850 | if (quoted) { |
| 1851 | sds unquoted = unquoteCString(argv[j]); |
| 1852 | if (!unquoted) { |
| 1853 | while (--j >= 0) sdsfree(res[j]); |
| 1854 | sds_free(res); |
| 1855 | return NULL; |
| 1856 | } |
| 1857 | res[j] = unquoted; |
| 1858 | } else { |
| 1859 | res[j] = sdsnew(argv[j]); |
| 1860 | } |
| 1861 | } |
| 1862 | |
| 1863 | return res; |
| 1864 | } |
| 1865 | |
| 1866 | static int issueCommandRepeat(int argc, char **argv, long repeat) { |
| 1867 | while (1) { |
no test coverage detected