MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getSdsArrayFromArgv

Function getSdsArrayFromArgv

app/redis-6.2.6/src/redis-cli.c:2034–2052  ·  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

2032 * invalid quoted string.
2033 */
2034static 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
2054static int issueCommandRepeat(int argc, char **argv, long repeat) {
2055 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