String objects in the form "2391" "-100" without any space and with a * range of values that can fit in an 8, 16 or 32 bit signed value can be * encoded as integers to save space */
| 317 | * range of values that can fit in an 8, 16 or 32 bit signed value can be |
| 318 | * encoded as integers to save space */ |
| 319 | int rdbTryIntegerEncoding(char *s, size_t len, unsigned char *enc) { |
| 320 | long long value; |
| 321 | char *endptr, buf[32]; |
| 322 | |
| 323 | /* Check if it's possible to encode this value as a number */ |
| 324 | value = strtoll(s, &endptr, 10); |
| 325 | if (endptr[0] != '\0') return 0; |
| 326 | ll2string(buf,32,value); |
| 327 | |
| 328 | /* If the number converted back into a string is not identical |
| 329 | * then it's not possible to encode the string as integer */ |
| 330 | if (strlen(buf) != len || memcmp(buf,s,len)) return 0; |
| 331 | |
| 332 | return rdbEncodeInteger(value,enc); |
| 333 | } |
| 334 | |
| 335 | ssize_t rdbSaveLzfBlob(rio *rdb, void *data, size_t compress_len, |
| 336 | size_t original_len) { |
no test coverage detected