Debuggng & adjustments.
authorSebastian Hammer <quinn@indexdata.com>
Mon, 15 May 1995 11:56:55 +0000 (11:56 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Mon, 15 May 1995 11:56:55 +0000 (11:56 +0000)
util/dmalloc.c
util/log.c
util/marcdump.c

index c7f2754..e8d693f 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dmalloc.c,v $
- * Revision 1.2  1995-04-10 10:23:50  quinn
+ * Revision 1.3  1995-05-15 11:56:55  quinn
+ * Debuggng & adjustments.
+ *
+ * Revision 1.2  1995/04/10  10:23:50  quinn
  * Fixes.
  *
  * Revision 1.1  1995/03/27  08:35:17  quinn
@@ -18,9 +21,9 @@
 #include <stdio.h>
 #include <string.h>
 
-static const unsigned long head = 0xaabbccdd;
-static const unsigned long tail = 0x11223344;
-static const unsigned long freed = 0xffeeffee;
+static const unsigned char head[] = {44, 33, 22, 11};
+static const unsigned char tail[] = {11, 22, 33, 44};
+static const unsigned char freed[] = {99, 99, 99, 99};
 
 void *d_malloc(char *file, int line, int nbytes)
 {
@@ -45,7 +48,7 @@ void d_free(char *file, int line, char *ptr)
 
     if (memcmp(&head, ptr - 2 * sizeof(long), sizeof(long)))
        abort();
-    memcpy(ptr, &freed, sizeof(long));
+    memcpy(ptr - 2 * sizeof(long), &freed, sizeof(long));
     memcpy(&len, ptr - sizeof(long), sizeof(long));
     if (memcmp(ptr + len, &tail, sizeof(long)))
        abort();
@@ -66,7 +69,7 @@ void *d_realloc(char *file, int line, char *ptr, int nbytes)
     memcpy(&len, ptr - sizeof(long), sizeof(long));
     if (memcmp(ptr + len, &tail, sizeof(long)))
        abort();
-    if (!(r = realloc(ptr, nbytes + 3 * sizeof(long))))
+    if (!(r = realloc(ptr - 2 * sizeof(long), nbytes + 3 * sizeof(long))))
        return 0;
     fprintf(stderr, "---d_realloc, '%s':%d, %d->%d, %p->%p\n",
        file, line, len, nbytes, p, r + 2 * sizeof(long));
index c025120..9319154 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: log.c,v $
- * Revision 1.3  1995-04-10 10:23:51  quinn
+ * Revision 1.4  1995-05-15 11:56:55  quinn
+ * Debuggng & adjustments.
+ *
+ * Revision 1.3  1995/04/10  10:23:51  quinn
  * Fixes.
  *
  * Revision 1.2  1995/03/31  10:16:55  quinn
@@ -88,7 +91,7 @@ void log_init(int level, const char *prefix, const char *name)
        return;
     if (!(l_file = fopen(name, "a")))
         return;
-    setbuffer(l_file, 0, 0);
+    setvbuf(l_file, 0, _IONBF, 0);
 }
 
 void logf(int level, const char *fmt, ...)
index 2b254cf..023de27 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: marcdump.c,v $
- * Revision 1.1  1995-04-10 10:28:47  quinn
+ * Revision 1.2  1995-05-15 11:56:56  quinn
+ * Debuggng & adjustments.
+ *
+ * Revision 1.1  1995/04/10  10:28:47  quinn
  * Added copy of CCL and MARC display
  *
  */
@@ -13,6 +16,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <marcdisp.h>
+#include <dmalloc.h>
 
 #ifndef SEEK_SET
 #define SEEK_SET 0