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

Function boolConfigSet

src/config.cpp:2029–2046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2027}
2028
2029static int boolConfigSet(typeData data, sds value, int update, const char **err) {
2030 int yn = yesnotoi(value);
2031 if (yn == -1) {
2032 if ((yn = truefalsetoi(value)) == -1) {
2033 *err = "argument must be 'yes' or 'no'";
2034 return 0;
2035 }
2036 }
2037 if (data.yesno.is_valid_fn && !data.yesno.is_valid_fn(yn, err))
2038 return 0;
2039 int prev = *(data.yesno.config);
2040 *(data.yesno.config) = yn;
2041 if (update && data.yesno.update_fn && !data.yesno.update_fn(yn, prev, err)) {
2042 *(data.yesno.config) = prev;
2043 return 0;
2044 }
2045 return 1;
2046}
2047
2048static void boolConfigGet(client *c, typeData data) {
2049 addReplyBulkCString(c, *data.yesno.config ? "yes" : "no");

Callers

nothing calls this directly

Calls 2

yesnotoiFunction · 0.85
truefalsetoiFunction · 0.85

Tested by

no test coverage detected