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

Function numericConfigSet

app/redis-6.2.6/src/config.c:2022–2052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2020}
2021
2022static int numericConfigSet(typeData data, sds value, int update, const char **err) {
2023 long long ll, prev = 0;
2024 if (data.numeric.is_memory) {
2025 int memerr;
2026 ll = memtoll(value, &memerr);
2027 if (memerr || ll < 0) {
2028 *err = "argument must be a memory value";
2029 return 0;
2030 }
2031 } else {
2032 if (!string2ll(value, sdslen(value),&ll)) {
2033 *err = "argument couldn't be parsed into an integer" ;
2034 return 0;
2035 }
2036 }
2037
2038 if (!numericBoundaryCheck(data, ll, err))
2039 return 0;
2040
2041 if (data.numeric.is_valid_fn && !data.numeric.is_valid_fn(ll, err))
2042 return 0;
2043
2044 GET_NUMERIC_TYPE(prev)
2045 SET_NUMERIC_TYPE(ll)
2046
2047 if (update && data.numeric.update_fn && !data.numeric.update_fn(ll, prev, err)) {
2048 SET_NUMERIC_TYPE(prev)
2049 return 0;
2050 }
2051 return 1;
2052}
2053
2054static void numericConfigGet(client *c, typeData data) {
2055 char buf[128];

Callers

nothing calls this directly

Calls 4

memtollFunction · 0.85
sdslenFunction · 0.85
numericBoundaryCheckFunction · 0.85
string2llFunction · 0.70

Tested by

no test coverage detected