MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / getSdsArrayFromArgv

Function getSdsArrayFromArgv

src/redis-cli.c:1846–1864  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

1844 * invalid quoted string.
1845 */
1846static 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
1866static int issueCommandRepeat(int argc, char **argv, long repeat) {
1867 while (1) {

Callers 1

noninteractiveFunction · 0.85

Calls 5

sds_mallocFunction · 0.85
unquoteCStringFunction · 0.85
sdsfreeFunction · 0.85
sds_freeFunction · 0.85
sdsnewFunction · 0.85

Tested by

no test coverage detected