Don't use calloc and our own malloc combined
This commit is contained in:
parent
f61ddc4926
commit
83ba395e03
|
@ -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)
|
||||
|
|
|
@ -30,17 +30,20 @@
|
|||
#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++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue