set up a controlled memory allocation space for monitoring, set the stream parameters to the controlled routines, with opaque pointing to the space */
| 156 | /* set up a controlled memory allocation space for monitoring, set the stream |
| 157 | parameters to the controlled routines, with opaque pointing to the space */ |
| 158 | local void mem_setup(z_stream *strm) |
| 159 | { |
| 160 | struct mem_zone *zone; |
| 161 | |
| 162 | zone = malloc(sizeof(struct mem_zone)); |
| 163 | assert(zone != NULL); |
| 164 | zone->first = NULL; |
| 165 | zone->total = 0; |
| 166 | zone->highwater = 0; |
| 167 | zone->limit = 0; |
| 168 | zone->notlifo = 0; |
| 169 | zone->rogue = 0; |
| 170 | strm->opaque = zone; |
| 171 | strm->zalloc = mem_alloc; |
| 172 | strm->zfree = mem_free; |
| 173 | } |
| 174 | |
| 175 | /* set a limit on the total memory allocation, or 0 to remove the limit */ |
| 176 | local void mem_limit(z_stream *strm, size_t limit) |
no test coverage detected