Lines Matching refs:ptr

97 	void *ptr;
100 ptr = malloc(MALLOC_SIZE(size));
102 if (ptr == NULL)
104 return ptr;
123 void *ptr;
126 ptr = malloc(MALLOC_SIZE(size));
128 return ptr;
135 ** ptr -- pointer to old memory area.
143 sm_realloc(ptr, size)
144 void *ptr;
150 newptr = realloc(ptr, MALLOC_SIZE(size));
159 ** ptr -- pointer to old memory area.
170 sm_realloc_x(ptr, size)
171 void *ptr;
177 newptr = realloc(ptr, MALLOC_SIZE(size));
187 ** ptr -- pointer to memory region.
194 sm_free(ptr)
195 void *ptr;
197 if (ptr == NULL)
200 free(ptr);
365 void *ptr;
370 ptr = malloc(MALLOC_SIZE(size));
372 return ptr;
381 ptr = malloc(MALLOC_SIZE(size));
383 if (ptr != NULL && !sm_heap_register(ptr, size, tag, num, group))
386 free(ptr);
388 ptr = NULL;
393 return ptr;
419 void *ptr;
424 ptr = malloc(MALLOC_SIZE(size));
426 if (ptr == NULL)
428 return ptr;
438 ptr = malloc(MALLOC_SIZE(size));
440 if (ptr != NULL && !sm_heap_register(ptr, size, tag, num, group))
443 free(ptr);
445 ptr = NULL;
447 if (ptr == NULL)
452 return ptr;
459 ** ptr -- pointer to register.
470 sm_heap_register(ptr, size, tag, num, group)
471 void *ptr;
482 SM_REQUIRE(ptr != NULL);
483 i = ptrhash(ptr);
487 ** We require that ptr is not already in SmHeapTable.
492 if (hi->hi_ptr == ptr)
493 sm_abort("sm_heap_register: ptr %p is already registered (%s:%d)",
494 ptr, hi->hi_tag, hi->hi_num);
502 hi->hi_ptr = ptr;
515 ** ptr -- pointer to old memory area.
523 sm_realloc(ptr, size)
524 void *ptr;
533 newptr = realloc(ptr, MALLOC_SIZE(size));
538 if (ptr == NULL)
541 for (hp = &SmHeapTable[ptrhash(ptr)]; *hp != NULL; hp = &(**hp).hi_next)
543 if ((**hp).hi_ptr == ptr)
555 newptr = realloc(ptr, MALLOC_SIZE(size));
571 sm_abort("sm_realloc: bad argument (%p)", ptr);
580 ** ptr -- pointer to old memory area.
591 sm_realloc_x(ptr, size)
592 void *ptr;
601 newptr = realloc(ptr, MALLOC_SIZE(size));
608 if (ptr == NULL)
611 for (hp = &SmHeapTable[ptrhash(ptr)]; *hp != NULL; hp = &(**hp).hi_next)
613 if ((**hp).hi_ptr == ptr)
624 newptr = realloc(ptr, MALLOC_SIZE(size));
640 sm_abort("sm_realloc_x: bad argument (%p)", ptr);
649 ** ptr -- pointer to memory region.
658 sm_free_tagged(ptr, tag, num)
659 void *ptr;
665 if (ptr == NULL)
670 free(ptr);
674 for (hp = &SmHeapTable[ptrhash(ptr)]; *hp != NULL; hp = &(**hp).hi_next)
676 if ((**hp).hi_ptr == ptr)
692 (void) memset(ptr, 0, hi->hi_size);
695 free(ptr);
701 sm_abort("sm_free: bad argument (%p) (%s:%d)", ptr, tag, num);
705 ** SM_HEAP_CHECKPTR_TAGGED -- check whether ptr is a valid argument to sm_free
708 ** ptr -- pointer to memory region.
720 sm_heap_checkptr_tagged(ptr, tag, num)
721 void *ptr;
729 if (ptr == NULL)
731 for (hp = SmHeapTable[ptrhash(ptr)]; hp != NULL; hp = hp->hi_next)
733 if (hp->hi_ptr == ptr)
736 sm_abort("sm_heap_checkptr(%p): bad ptr (%s:%d)", ptr, tag, num);