Modified function heads & prototypes.
[yaz-moved-to-github.git] / util / dmalloc.c
index e8d693f..a5a5bda 100644 (file)
@@ -1,10 +1,19 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
- * All rights reserved.
+ * Copyright (c) 1995, Index Data
+ * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: dmalloc.c,v $
- * Revision 1.3  1995-05-15 11:56:55  quinn
+ * Revision 1.6  1995-09-27 15:03:02  quinn
+ * Modified function heads & prototypes.
+ *
+ * Revision 1.5  1995/05/16  08:51:10  quinn
+ * License, documentation, and memory fixes
+ *
+ * Revision 1.4  1995/05/15  13:25:13  quinn
+ * Fixed memory bug.
+ *
+ * Revision 1.3  1995/05/15  11:56:55  quinn
  * Debuggng & adjustments.
  *
  * Revision 1.2  1995/04/10  10:23:50  quinn
@@ -25,7 +34,7 @@ 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)
+void MDF *d_malloc(char *file, int line, int nbytes)
 {
     char *res;
     int long len;
@@ -42,7 +51,7 @@ void *d_malloc(char *file, int line, int nbytes)
     return res;
 }
 
-void d_free(char *file, int line, char *ptr)
+void MDF d_free(char *file, int line, char *ptr)
 {
     long len;
 
@@ -58,7 +67,7 @@ void d_free(char *file, int line, char *ptr)
     return;
 }
 
-void *d_realloc(char *file, int line, char *ptr, int nbytes)
+void MDF *d_realloc(char *file, int line, char *ptr, int nbytes)
 {
     long len, nlen = nbytes;
     char *p = ptr;
@@ -75,11 +84,6 @@ void *d_realloc(char *file, int line, char *ptr, int nbytes)
        file, line, len, nbytes, p, r + 2 * sizeof(long));
     memcpy(r, &head, sizeof(long));
     memcpy(r + sizeof(long), &nlen, sizeof(long));
-    if (r != ptr - 2 * sizeof(long))
-    {
-       memcpy(r + 2 * sizeof(long), ptr, len);
-       memcpy(ptr - 2 * sizeof(long), &freed, sizeof(long));
-    }
     r += 2 * sizeof(long);
     memcpy(r + nbytes, &tail, sizeof(long));
     return r;