-/* $OpenBSD: defs.h,v 1.13 2014/01/08 21:40:25 millert Exp $ */
+/* $OpenBSD: defs.h,v 1.14 2014/01/08 22:30:32 millert Exp $ */
/* $NetBSD: defs.h,v 1.6 1996/03/19 03:21:30 jtc Exp $ */
/*
/* storage allocation macros */
-#define NEW(t) ((t*)allocate(sizeof(t)))
-#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t))))
+#define NEW(t) (allocate(sizeof(t)))
+#define NEW2(n,t) (allocate((n)*sizeof(t)))
/* the structure of a symbol table entry */
/* global functions */
-extern char *allocate();
-extern bucket *lookup();
-extern bucket *make_bucket();
+extern void *allocate(size_t);
+extern bucket *lookup(char *);
+extern bucket *make_bucket(char *);
extern void set_first_derives(void);
extern void closure(short *, int);
extern void finalize_closure(void);
-/* $OpenBSD: lr0.c,v 1.13 2014/01/08 21:40:25 millert Exp $ */
+/* $OpenBSD: lr0.c,v 1.14 2014/01/08 22:30:32 millert Exp $ */
/* $NetBSD: lr0.c,v 1.4 1996/03/19 03:21:35 jtc Exp $ */
/*
iend = kernel_end[symbol];
n = iend - isp1;
- p = (core *) allocate((unsigned) (sizeof(core) + (n - 1) * sizeof(short)));
+ p = allocate(sizeof(core) + (n - 1) * sizeof(short));
p->accessing_symbol = symbol;
p->number = nstates;
p->nitems = n;
short *sp2;
short *send;
- p = (shifts *) allocate((unsigned) (sizeof(shifts) +
- (nshifts - 1) * sizeof(short)));
+ p = allocate(sizeof(shifts) + (nshifts - 1) * sizeof(short));
p->number = this_state->number;
p->nshifts = nshifts;
if (count)
{
- p = (reductions *) allocate((unsigned) (sizeof(reductions) +
- (count - 1) * sizeof(short)));
+ p = allocate(sizeof(reductions) + (count - 1) * sizeof(short));
p->number = this_state->number;
p->nreds = count;
-/* $OpenBSD: main.c,v 1.24 2014/01/08 21:40:25 millert Exp $ */
+/* $OpenBSD: main.c,v 1.25 2014/01/08 22:30:32 millert Exp $ */
/* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */
/*
}
-char *
-allocate(unsigned int n)
+void *
+allocate(size_t n)
{
- char *p;
+ void *v;
- p = NULL;
+ v = NULL;
if (n)
{
- p = calloc(1, n);
- if (!p) no_space();
+ v = calloc(1, n);
+ if (!v) no_space();
}
- return (p);
+ return (v);
}
#define TEMPNAME(s, c, d, l) \