Lines Matching defs:mptr
177 #define malloc2user_(mptr) (((char*)(void*)(mptr))+sizeof(Word))
191 #define nsize1_(mptr) (((Word*)(void*)(mptr))->nsize1)
192 #define nsize2_(mptr) (((Word*)(void*)(mptr))->nsize2)
196 #define tail_nsize1_(mptr) \
197 nsize1_(((char*)(void*)(mptr))+round_up_(-nsize1_(mptr))+sizeof(Word))
198 #define tail_nsize2_(mptr) \
199 nsize2_(((char*)(void*)(mptr))+round_up_(-nsize1_(mptr))+sizeof(Word))
211 #define last_user_word_(mptr) \
212 ((int*)(((char*)(void*)(mptr))+round_up_(-nsize1_(mptr))))
215 #define warrant_(mptr) \
216 (*((Warrant_Record*)(void*)(((char*)(void*)(mptr))+round_up_(-nsize1_(mptr))+sizeof(Word)*2)))
221 void *link; /* Next mptr in list */
226 #define warrant_link_(mptr) warrant_(mptr).link
227 #define warrant_name_(mptr) warrant_(mptr).name
228 #define warrant_line_(mptr) warrant_(mptr).line
229 #define warrant_id_(mptr) warrant_(mptr).id
230 #define MFILE(mptr) (malloc_watch?warrant_name_(mptr):"?")
231 #define MLINE(mptr) (malloc_watch?warrant_line_(mptr):0)
232 #define MID(mptr) (malloc_watch?warrant_id_(mptr):0)
272 * pointer with the error is in 'mptr'.
275 memory_error(void *mptr, const char *name, int mid, const char *mfile, int mline, const char *file, int line)
293 len = -nsize1_(mptr);
299 nice_words, mid, mptr, len, len, mfile, mline,
305 void *uptr = malloc2user_(mptr);
358 * malloc pointer "mptr".
361 setup_space_and_issue_warrant(void *mptr, size_t size, const char *file, int line)
369 if ( mptr > largest_addr ) largest_addr = mptr;
371 if ( mptr < smallest_addr || smallest_addr == NULL ) smallest_addr = mptr;
374 nsize1_(mptr) = -nbytes;
375 nsize2_(mptr) = -nbytes;
376 tail_nsize1_(mptr) = -nbytes;
377 tail_nsize2_(mptr) = -nbytes;
388 p = ((char *) mptr) + sizeof(Word) + nbytes;
402 warrant_(mptr) = zero_warrant;
403 p1 = warrant_name_(mptr);
412 warrant_line_(mptr) = line;
413 warrant_id_(mptr) = ++id_counter;
414 warrant_link_(mptr) = first_warrant_mptr;
415 first_warrant_mptr = mptr;
484 * mptr The pointer to the malloc space being removed
487 remove_warrant(void *mptr)
493 if (malloc_watch && mptr != NULL) {
500 if (mptr1 == mptr) {
519 void *mptr;
525 mptr = user2malloc_(uptr);
526 memory_check(uptr, (mid=MID(mptr)), (mfile=MFILE(mptr)), (mline=MLINE(mptr)), file, line);
527 if (malloc_watch && remove_warrant(mptr)==0 )
530 if ( mptr!=NULL ) {
531 size_t nbytes = -nsize1_(mptr);
533 (void)memset(mptr, FREED_CHAR, rbytes_(nbytes));
536 free(mptr);
547 void *mptr;
552 mptr = user2malloc_(uptr);
553 memory_check(uptr, MID(mptr), MFILE(mptr), MLINE(mptr), file, line);
599 void *mptr;
607 mptr = malloc(rbytes_(nbytes));
608 if (mptr == NULL)
610 setup_space_and_issue_warrant(mptr, nbytes, file, line);
611 uptr = malloc2user_(mptr);
621 void *mptr;
639 mptr = malloc(rbytes_(nbytes));
642 mptr = realloc(oldmptr, rbytes_(nbytes));
644 if (mptr == NULL)
646 setup_space_and_issue_warrant(mptr, nbytes, file, line);
647 newuptr = malloc2user_(mptr);
661 void *mptr;
670 mptr = calloc(rbytes_(nbytes),1);
671 if (mptr == NULL)
673 setup_space_and_issue_warrant(mptr, nbytes, file, line);
674 return malloc2user_(mptr);
681 void *mptr;
693 mptr = malloc(rbytes_(nbytes));
694 if (mptr == NULL)
696 setup_space_and_issue_warrant(mptr, nbytes, file, line);
697 uptr = malloc2user_(mptr);
705 void *mptr;
714 mptr = first_warrant_mptr;
715 if (mptr != NULL) {
718 memory_check(malloc2user_(mptr), MID(mptr), MFILE(mptr), MLINE(mptr), file, line);
719 mptr = warrant_link_(mptr);
720 } while (mptr != NULL);
728 void *mptr;
738 mptr = first_warrant_mptr;
739 if (mptr != NULL) {
742 mptr = first_warrant_mptr;
745 mptr, -nsize1_(mptr), warrant_name_(mptr),
746 warrant_line_(mptr), warrant_id_(mptr));
748 mptr = warrant_link_(mptr);
749 } while (mptr != NULL);