~mdw
/
become
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(class__wildMatch) Fixed bug which overran pattern string, spotted by
[become]
/
src
/
utils.c
diff --git
a/src/utils.c
b/src/utils.c
index
0e0adee
..
c6e1313
100644
(file)
--- a/
src/utils.c
+++ b/
src/utils.c
@@
-1,10
+1,10
@@
/* -*-c-*-
*
/* -*-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.
*
*
* Miscellaneous useful bits of code.
*
- * (c) 199
7
Mark Wooding
+ * (c) 199
8
Mark Wooding
*/
/*----- Licensing notice --------------------------------------------------*
*/
/*----- Licensing notice --------------------------------------------------*
@@
-29,7
+29,13
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: utils.c,v $
/*----- 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
* 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
if (q) {
memused += sz;
#ifdef TRACK_VERBOSE
+ fflush(0);
printf("[%p] allocated %lu\n", (void *)(q + 1), (unsigned long)sz);
printf("[%p] allocated %lu\n", (void *)(q + 1), (unsigned long)sz);
+ fflush(stdout);
#endif
q->x.sz = sz;
q->x.next = memlist;
#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
return;
q = (szblock *)p - 1;
#ifdef TRACK_VERBOSE
+ fflush(0);
printf("[%p] freed %lu\n", (void *)(q + 1), (unsigned long)q->x.sz);
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;
#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
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);
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;
#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;
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");
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
}
#endif