Lines Matching +full:in +full:- +full:and +full:- +full:around
2 * Copyright (c) 2000-2001, 2004 Sendmail, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
44 "@(#)$Debug: sm_check_heap - check sm_malloc, sm_realloc, sm_free calls $");
63 ** says so in the C standard): it can return NULL or non-NULL. We
66 ** two choices: "size = 1" or "return NULL". We use the former in the
69 ** behaviour of the platform and either use this hack or just
76 ** SM_MALLOC_X -- wrapper around malloc(), raises an exception on error.
79 ** size -- size of requested memory.
85 ** sm_malloc_x only gets called from source files in which heap
90 ** F:sm_heap -- out of memory
110 ** SM_MALLOC -- wrapper around malloc()
113 ** size -- size of requested memory.
132 ** SM_REALLOC -- wrapper for realloc()
135 ** ptr -- pointer to old memory area.
136 ** size -- size of requested memory.
156 ** SM_REALLOC_X -- wrapper for realloc()
159 ** ptr -- pointer to old memory area.
160 ** size -- size of requested memory.
166 ** F:sm_heap -- out of memory
184 ** SM_FREE -- wrapper around free()
187 ** ptr -- pointer to memory region.
211 ** You can use group numbers any way you want, in order to help make
238 "@(#)$Debug: sm_heap_limit - max # of bytes permitted in heap $");
262 ** of each of the numbers between 0 and 255.
287 ** PTRHASH -- hash a pointer value
290 ** p -- pointer.
296 ** number between 0 and 255.
299 ** "Fast Hashing of Variable-Length Text Strings",
300 ** in Communications of the ACM, June 1990, vol 33 no 6.
346 ** SM_MALLOC_TAGGED -- wrapper around malloc(), debugging version.
349 ** size -- size of requested memory.
350 ** tag -- tag for debugging.
351 ** num -- additional value for debugging.
352 ** group -- heap group for debugging.
397 ** SM_MALLOC_TAGGED_X -- wrapper around malloc(), debugging version.
400 ** size -- size of requested memory.
401 ** tag -- tag for debugging.
402 ** num -- additional value for debugging.
403 ** group -- heap group for debugging.
409 ** F:sm_heap -- out of memory
456 ** SM_HEAP_REGISTER -- register a pointer into the heap for debugging.
459 ** ptr -- pointer to register.
460 ** size -- size of requested memory.
461 ** tag -- tag for debugging.
462 ** num -- additional value for debugging.
463 ** group -- heap group for debugging.
466 ** true iff successfully registered (not yet in table).
487 ** We require that ptr is not already in SmHeapTable.
490 for (hi = SmHeapTable[i]; hi != NULL; hi = hi->hi_next)
492 if (hi->hi_ptr == ptr)
494 ptr, hi->hi_tag, hi->hi_num);
502 hi->hi_ptr = ptr;
503 hi->hi_size = size;
504 hi->hi_tag = tag;
505 hi->hi_num = num;
506 hi->hi_group = group;
507 hi->hi_next = SmHeapTable[i];
512 ** SM_REALLOC -- wrapper for realloc(), debugging version.
515 ** ptr -- pointer to old memory area.
516 ** size -- size of requested memory.
550 < SmHeapTotal - hi->hi_size + size)
559 SmHeapTotal = SmHeapTotal - hi->hi_size + size;
562 *hp = hi->hi_next;
563 hi->hi_ptr = newptr;
564 hi->hi_size = size;
566 hi->hi_next = *hp;
577 ** SM_REALLOC_X -- wrapper for realloc(), debugging version.
580 ** ptr -- pointer to old memory area.
581 ** size -- size of requested memory.
587 ** F:sm_heap -- out of memory
619 < SmHeapTotal - hi->hi_size + size)
628 SmHeapTotal = SmHeapTotal - hi->hi_size + size;
631 *hp = hi->hi_next;
632 hi->hi_ptr = newptr;
633 hi->hi_size = size;
635 hi->hi_next = *hp;
646 ** SM_FREE_TAGGED -- wrapper around free(), debugging version.
649 ** ptr -- pointer to memory region.
650 ** tag -- tag for debugging.
651 ** num -- additional value for debugging.
680 *hp = hi->hi_next;
686 ** zeros, not with some non-zero value, because
687 ** it is common practice in some C code to store
688 ** a zero in a structure member before freeing the
692 (void) memset(ptr, 0, hi->hi_size);
693 SmHeapTotal -= hi->hi_size;
705 ** SM_HEAP_CHECKPTR_TAGGED -- check whether ptr is a valid argument to sm_free
708 ** ptr -- pointer to memory region.
709 ** tag -- tag for debugging.
710 ** num -- additional value for debugging.
731 for (hp = SmHeapTable[ptrhash(ptr)]; hp != NULL; hp = hp->hi_next)
733 if (hp->hi_ptr == ptr)
740 ** SM_HEAP_REPORT -- output "map" of used heap.
743 ** stream -- the file pointer to write to.
744 ** verbosity -- how much info?
768 || (verbosity > 1 && hi->hi_group != 0))
772 hi->hi_group,
774 (long)hi->hi_ptr,
775 (unsigned long)hi->hi_size);
776 if (hi->hi_tag != NULL)
780 hi->hi_tag);
781 if (hi->hi_num)
786 hi->hi_num);
791 switch (hi->hi_group)
794 group0total += hi->hi_size;
797 group1total += hi->hi_size;
800 otherstotal += hi->hi_size;
803 grandtotal += hi->hi_size;
804 hi = hi->hi_next;