X-Git-Url: https://git.distorted.org.uk/~mdw/become/blobdiff_plain/d0168b6575f335de6fc804b81646c1312487819e..c758e6541ca05409b178dd9629e9337494c49890:/src/utils.c diff --git a/src/utils.c b/src/utils.c index 0e0adee..c6e1313 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,10 +1,10 @@ /* -*-c-*- * - * $Id: utils.c,v 1.4 1997/09/08 13:43:54 mdw Exp $ + * $Id: utils.c,v 1.6 1998/01/12 16:46:47 mdw Exp $ * * Miscellaneous useful bits of code. * - * (c) 1997 Mark Wooding + * (c) 1998 Mark Wooding */ /*----- Licensing notice --------------------------------------------------* @@ -29,7 +29,13 @@ /*----- Revision history --------------------------------------------------* * * $Log: utils.c,v $ - * Revision 1.4 1997/09/08 13:43:54 mdw + * Revision 1.6 1998/01/12 16:46:47 mdw + * Fix copyright date. + * + * Revision 1.5 1997/09/17 10:24:47 mdw + * Flush output before and after writing memory tracking information. + * + * Revision 1.4 1997/09/08 13:43:54 mdw * Flush tracedump file after each `interesting' write. * * Revision 1.3 1997/08/20 16:25:37 mdw @@ -369,7 +375,9 @@ void *track_malloc(size_t sz) if (q) { memused += sz; #ifdef TRACK_VERBOSE + fflush(0); printf("[%p] allocated %lu\n", (void *)(q + 1), (unsigned long)sz); + fflush(stdout); #endif q->x.sz = sz; q->x.next = memlist; @@ -399,7 +407,9 @@ void track_free(void *p) return; q = (szblock *)p - 1; #ifdef TRACK_VERBOSE + fflush(0); printf("[%p] freed %lu\n", (void *)(q + 1), (unsigned long)q->x.sz); + fflush(stdout); #endif if (q->x.next) q->x.next->x.prev = q->x.prev; @@ -442,9 +452,11 @@ void *track_realloc(void *p, size_t sz) qq = (realloc)(q, sz + sizeof(szblock)); if (qq) { #ifdef TRACK_VERBOSE + fflush(0); printf("[%p->%p] reallocated %lu -> %lu\n", (void *)(q + 1), (void *)(qq + 1), (unsigned long)osz, (unsigned long)sz); + fflush(stdout); #endif qq->x.sz = sz; qq->x.next = memlist; @@ -486,12 +498,14 @@ unsigned long track_memused(void) void track_memlist(void) { szblock *q = memlist; + fflush(0); printf("listing blocks:\n"); while (q) { printf("... [%p] %lu\n", (void *)(q + 1), (unsigned long)q->x.sz); q = q->x.next; } printf("done\n"); + fflush(stdout); } #endif