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

Function string2l

app/redis-6.2.6/src/util.c:474–485  ·  view source on GitHub ↗

Convert a string into a long. Returns 1 if the string could be parsed into a * (non-overflowing) long, 0 otherwise. The value will be set to the parsed * value when appropriate. */

Source from the content-addressed store, hash-verified

472 * (non-overflowing) long, 0 otherwise. The value will be set to the parsed
473 * value when appropriate. */
474int string2l(const char *s, size_t slen, long *lval) {
475 long long llval;
476
477 if (!string2ll(s,slen,&llval))
478 return 0;
479
480 if (llval < LONG_MIN || llval > LONG_MAX)
481 return 0;
482
483 *lval = (long)llval;
484 return 1;
485}
486
487/* Convert a string into a double. Returns 1 if the string could be parsed
488 * into a (non-overflowing) double, 0 otherwise. The value will be set to

Callers 3

ldbBreakFunction · 0.85
tryObjectEncodingFunction · 0.85
test_string2lFunction · 0.85

Calls 1

string2llFunction · 0.70

Tested by 1

test_string2lFunction · 0.68