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