Lines Matching +full:len +full:- +full:or +full:- +full:limit

1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
4 * Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu>
21 size_t len; member
25 /* Buffer used to store int-to-ASCII conversions. Will only be implemented if
27 * store "18446744073709551615" or "-9223372036854775808" and the final zero.
38 return j >= 0 ? j : -j; in abs()
44 return j >= 0 ? j : -j; in labs()
50 return j >= 0 ? j : -j; in llabs()
69 if (*s == '-') { in atol()
75 d = (*s++) - '0'; in atol()
82 return neg ? -ret : ret; in atol()
100 munmap(heap, heap->len); in free()
127 void *malloc(size_t len) in malloc() argument
132 len = sizeof(*heap) + len; in malloc()
133 len = (len + 4095UL) & -4096UL; in malloc()
134 heap = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, in malloc()
135 -1, 0); in malloc()
139 heap->len = len; in malloc()
140 return heap->user_p; in malloc()
171 user_p_len = heap->len - sizeof(*heap); in realloc()
184 memcpy(ret, heap->user_p, user_p_len); in realloc()
185 munmap(heap, heap->len); in realloc()
191 * trailing zero (17 bytes for "ffffffffffffffff" or 9 for "ffffffff"). The
206 in -= (uint64_t)dig << pos; in utoh_r()
207 pos -= 4; in utoh_r()
210 dig += 'a' - '0' - 10; in utoh_r()
231 * trailing zero (21 bytes for 18446744073709551615 in 64-bit, 11 for
232 * 4294967295 in 32-bit). The buffer is filled from the first byte, and the
251 in -= lim; in utoa_r()
254 } while (pos--); in utoa_r()
262 * trailing zero (21 bytes for -9223372036854775808 in 64-bit, 12 for
263 * -2147483648 in 32-bit). The buffer is filled from the first byte, and the
270 int len = 0; in itoa_r() local
273 in = -(unsigned long)in; in itoa_r()
274 *(ptr++) = '-'; in itoa_r()
275 len++; in itoa_r()
277 len += utoa_r(in, ptr); in itoa_r()
278 return len; in itoa_r()
321 /* Converts the unsigned 64-bit integer <in> to its hex representation into
340 /* 32-bit platforms: avoid a 64-bit shift */ in u64toh_r()
345 dig += 'a' - '0' - 10; in u64toh_r()
346 pos -= 4; in u64toh_r()
365 /* Converts the unsigned 64-bit integer <in> to its string representation into
387 in -= lim; in u64toa_r()
390 } while (pos--); in u64toa_r()
396 /* Converts the signed 64-bit integer <in> to its string representation into
398 * trailing zero (21 bytes for -9223372036854775808). The buffer is filled from
406 int len = 0; in i64toa_r() local
409 in = -(uint64_t)in; in i64toa_r()
410 *(ptr++) = '-'; in i64toa_r()
411 len++; in i64toa_r()
413 len += u64toa_r(in, ptr); in i64toa_r()
414 return len; in i64toa_r()
442 uintmax_t val = 0, limit, old_val; in __strtox() local
455 } else if (*nptr == '-') { in __strtox()
461 limit = -(uintmax_t)lower_limit; in __strtox()
463 limit = upper_limit; in __strtox()
480 c -= '0'; in __strtox()
482 c = c - 'a' + 10; in __strtox()
484 c = c - 'A' + 10; in __strtox()
496 if (val > limit || val < old_val) in __strtox()
503 val = limit; in __strtox()
507 return neg ? -val : val; in __strtox()