Don't use calloc and our own malloc combined
authorceriel <none@none>
Mon, 2 Dec 1991 14:44:20 +0000 (14:44 +0000)
committerceriel <none@none>
Mon, 2 Dec 1991 14:44:20 +0000 (14:44 +0000)
lang/m2/m2mm/main.c
lang/m2/m2mm/program.g

index 95a8433..74042b1 100644 (file)
@@ -122,13 +122,19 @@ struct file_list *
 new_file_list()
 {
        static struct file_list *p;
+       register struct file_list *f;
        static int cnt;
-       extern char *calloc();
 
-       if (cnt--) return p++;
-       p = (struct file_list *)calloc(50, sizeof(struct file_list));
-       cnt = 49;
-       return p++;
+       if (cnt-- < 0) {
+               p = (struct file_list *)Malloc(50*sizeof(struct file_list));
+               cnt = 49;
+       }
+       f = p++;
+       f->a_filename = 0;
+       f->a_dir = 0;
+       f->a_next = 0;
+       f->a_idf = 0;
+       f->a_notfound = 0;
 }
 
 Add(parglist, f, d, copy)
index 8cc218f..80d0293 100644 (file)
 #include       "idf.h"
 #include       "f_info.h"
 #include       "LLlex.h"
+#include       <alloc.h>
 
 struct lnk *
 new_lnk()
 {
        static struct lnk *p;
        static int cnt;
-       extern char *calloc();
 
-       if (cnt--) return p++;
-       p = (struct lnk *)calloc(50, sizeof(struct lnk));
-       cnt = 49;
+       if (cnt-- <= 0) {
+               p = (struct lnk *)Malloc(50*sizeof(struct lnk));
+               cnt = 49;
+       }
+       p->lnk_next = 0;
+       p->lnk_imp = 0;
        return p++;
 }
 }