Lines Matching defs:ptr
99 void *ptr;
102 ptr = malloc(MALLOC_SIZE(size));
104 if (ptr == NULL)
106 return ptr;
125 void *ptr;
128 ptr = malloc(MALLOC_SIZE(size));
130 return ptr;
137 ** ptr -- pointer to old memory area.
145 sm_realloc(ptr, size)
146 void *ptr;
152 newptr = realloc(ptr, MALLOC_SIZE(size));
161 ** ptr -- pointer to old memory area.
172 sm_realloc_x(ptr, size)
173 void *ptr;
179 newptr = realloc(ptr, MALLOC_SIZE(size));
189 ** ptr -- pointer to memory region.
196 sm_free(ptr)
197 void *ptr;
199 if (ptr == NULL)
202 free(ptr);
367 void *ptr;
372 ptr = malloc(MALLOC_SIZE(size));
374 return ptr;
383 ptr = malloc(MALLOC_SIZE(size));
385 if (ptr != NULL && !sm_heap_register(ptr, size, tag, num, group))
388 free(ptr);
390 ptr = NULL;
395 return ptr;
421 void *ptr;
426 ptr = malloc(MALLOC_SIZE(size));
428 if (ptr == NULL)
430 return ptr;
440 ptr = malloc(MALLOC_SIZE(size));
442 if (ptr != NULL && !sm_heap_register(ptr, size, tag, num, group))
445 free(ptr);
447 ptr = NULL;
449 if (ptr == NULL)
454 return ptr;
461 ** ptr -- pointer to register.
472 sm_heap_register(ptr, size, tag, num, group)
473 void *ptr;
484 SM_REQUIRE(ptr != NULL);
485 i = ptrhash(ptr);
489 ** We require that ptr is not already in SmHeapTable.
494 if (hi->hi_ptr == ptr)
495 sm_abort("sm_heap_register: ptr %p is already registered (%s:%d)",
496 ptr, hi->hi_tag, hi->hi_num);
504 hi->hi_ptr = ptr;
517 ** ptr -- pointer to old memory area.
525 sm_realloc(ptr, size)
526 void *ptr;
535 newptr = realloc(ptr, MALLOC_SIZE(size));
540 if (ptr == NULL)
543 for (hp = &SmHeapTable[ptrhash(ptr)]; *hp != NULL; hp = &(**hp).hi_next)
545 if ((**hp).hi_ptr == ptr)
557 newptr = realloc(ptr, MALLOC_SIZE(size));
573 sm_abort("sm_realloc: bad argument (%p)", ptr);
582 ** ptr -- pointer to old memory area.
593 sm_realloc_x(ptr, size)
594 void *ptr;
603 newptr = realloc(ptr, MALLOC_SIZE(size));
610 if (ptr == NULL)
613 for (hp = &SmHeapTable[ptrhash(ptr)]; *hp != NULL; hp = &(**hp).hi_next)
615 if ((**hp).hi_ptr == ptr)
626 newptr = realloc(ptr, MALLOC_SIZE(size));
642 sm_abort("sm_realloc_x: bad argument (%p)", ptr);
651 ** ptr -- pointer to memory region.
660 sm_free_tagged(ptr, tag, num)
661 void *ptr;
667 if (ptr == NULL)
672 free(ptr);
676 for (hp = &SmHeapTable[ptrhash(ptr)]; *hp != NULL; hp = &(**hp).hi_next)
678 if ((**hp).hi_ptr == ptr)
694 (void) memset(ptr, 0, hi->hi_size);
697 free(ptr);
703 sm_abort("sm_free: bad argument (%p) (%s:%d)", ptr, tag, num);
707 ** SM_HEAP_CHECKPTR_TAGGED -- check whether ptr is a valid argument to sm_free
710 ** ptr -- pointer to memory region.
722 sm_heap_checkptr_tagged(ptr, tag, num)
723 void *ptr;
731 if (ptr == NULL)
733 for (hp = SmHeapTable[ptrhash(ptr)]; hp != NULL; hp = hp->hi_next)
735 if (hp->hi_ptr == ptr)
738 sm_abort("sm_heap_checkptr(%p): bad ptr (%s:%d)", ptr, tag, num);