| 2966 | RESTORE_WARNING_CONDEXPR_IS_CONSTANT |
| 2967 | |
| 2968 | staticfn void * |
| 2969 | nhl_alloc(void *ud, void *ptr, size_t osize UNUSED, size_t nsize) |
| 2970 | { |
| 2971 | nhl_user_data *nud = ud; |
| 2972 | |
| 2973 | if (nsize == 0) { |
| 2974 | if (ptr != NULL) { |
| 2975 | free(ptr); |
| 2976 | } |
| 2977 | return NULL; |
| 2978 | } |
| 2979 | |
| 2980 | /* Check nud->L because it will be NULL during state init. */ |
| 2981 | if (nud && nud->L && nud->memlimit) { /* this state is size limited */ |
| 2982 | if (nhl_getmeminuse(nud->L) > nud->memlimit) |
| 2983 | return NULL; |
| 2984 | } |
| 2985 | |
| 2986 | return re_alloc(ptr, (unsigned) nsize); |
| 2987 | } |
| 2988 | |
| 2989 | DISABLE_WARNING_UNREACHABLE_CODE |
| 2990 |
no test coverage detected