Shrink the memory to fit. */
| 241 | |
| 242 | /* Shrink the memory to fit. */ |
| 243 | unsigned char* lpShrinkToFit(unsigned char *lp) { |
| 244 | size_t size = lpGetTotalBytes(lp); |
| 245 | if (size < lp_malloc_size(lp)) { |
| 246 | return lp_realloc(lp, size); |
| 247 | } else { |
| 248 | return lp; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /* Given an element 'ele' of size 'size', determine if the element can be |
| 253 | * represented inside the listpack encoded as integer, and returns |