Changed types in core allocation routines, changed lint flags
This commit is contained in:
parent
e37c249248
commit
1139272435
8 changed files with 42 additions and 38 deletions
|
@ -6,13 +6,14 @@ SHARE=../share
|
||||||
LDFLAGS=-i
|
LDFLAGS=-i
|
||||||
CPPFLAGS=-DVERBOSE -DNOTCOMPACT
|
CPPFLAGS=-DVERBOSE -DNOTCOMPACT
|
||||||
CFLAGS=$(CPPFLAGS) -O
|
CFLAGS=$(CPPFLAGS) -O
|
||||||
LINTFLAGS=-hbac
|
LINTFLAGS=-hbu
|
||||||
|
|
||||||
|
CFILES=\
|
||||||
|
debug.c global.c files.c go.c map.c aux.c get.c put.c alloc.c lset.c\
|
||||||
|
cset.c parser.c stack_chg.c locals.c init_glob.c
|
||||||
SRC=\
|
SRC=\
|
||||||
types.h def.h debug.h debug.c global.h global.c files.h files.c go.h go.c\
|
types.h def.h debug.h global.h files.h go.h map.h aux.h get.h put.h alloc.h\
|
||||||
map.h map.c aux.h aux.c get.h get.c put.h put.c alloc.h alloc.c lset.h lset.c\
|
lset.h cset.h parser.h stack_chg.h locals.h init_glob.h $(CFILES)
|
||||||
cset.h cset.c parser.h parser.c stack_chg.h stack_chg.c locals.h locals.c\
|
|
||||||
init_glob.h init_glob.c
|
|
||||||
|
|
||||||
PRFILES=$(SRC)
|
PRFILES=$(SRC)
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
|
|
||||||
|
|
||||||
short * myalloc();
|
char * myalloc();
|
||||||
short * malloc();
|
char * calloc();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
STATIC unsigned maxuse, curruse;
|
STATIC unsigned maxuse, curruse;
|
||||||
|
|
||||||
short *newcore(size)
|
char *newcore(size)
|
||||||
int size;
|
int size;
|
||||||
{
|
{
|
||||||
if ((curruse += (unsigned) (size+2)) > maxuse) maxuse = curruse;
|
if ((curruse += (unsigned) (size+2)) > maxuse) maxuse = curruse;
|
||||||
|
@ -31,7 +31,7 @@ short *newcore(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
oldcore(p,size)
|
oldcore(p,size)
|
||||||
short *p;
|
char *p;
|
||||||
int size;
|
int size;
|
||||||
{
|
{
|
||||||
curruse -= (size+2);
|
curruse -= (size+2);
|
||||||
|
@ -129,7 +129,7 @@ oldline(lnp) register line_p lnp; {
|
||||||
|
|
||||||
if (kind == OPLIST)
|
if (kind == OPLIST)
|
||||||
oldargs(ARG(lnp));
|
oldargs(ARG(lnp));
|
||||||
oldcore((short *) lnp,lsizetab[kind]);
|
oldcore((char *) lnp,lsizetab[kind]);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_p newarg(kind) int kind; {
|
arg_p newarg(kind) int kind; {
|
||||||
|
@ -155,7 +155,7 @@ oldargs(ap) register arg_p ap; {
|
||||||
oldargb(ap->a_a.a_con.ac_con.ab_next);
|
oldargb(ap->a_a.a_con.ac_con.ab_next);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
oldcore((short *) ap,asizetab[ap->a_type]);
|
oldcore((char *) ap,asizetab[ap->a_type]);
|
||||||
ap = next;
|
ap = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ oldargb(abp) register argb_p abp; {
|
||||||
|
|
||||||
while (abp != (argb_p) 0) {
|
while (abp != (argb_p) 0) {
|
||||||
next = abp->ab_next;
|
next = abp->ab_next;
|
||||||
oldcore((short *) abp,sizeof (argb_t));
|
oldcore((char *) abp,sizeof (argb_t));
|
||||||
abp = next;
|
abp = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ oldobjects(op) register obj_p op; {
|
||||||
|
|
||||||
while (op != (obj_p) 0) {
|
while (op != (obj_p) 0) {
|
||||||
next = op->o_next;
|
next = op->o_next;
|
||||||
oldcore((short *) op, sizeof(struct obj));
|
oldcore((char *) op, sizeof(struct obj));
|
||||||
op = next;
|
op = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ oldobjects(op) register obj_p op; {
|
||||||
olddblock(dbl) dblock_p dbl; {
|
olddblock(dbl) dblock_p dbl; {
|
||||||
oldobjects(dbl->d_objlist);
|
oldobjects(dbl->d_objlist);
|
||||||
oldargs(dbl->d_values);
|
oldargs(dbl->d_values);
|
||||||
oldcore((short *) dbl, sizeof(struct dblock));
|
oldcore((char *) dbl, sizeof(struct dblock));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,8 +191,9 @@ short **newmap(length) short length; {
|
||||||
return((short **) newcore((length+1) * sizeof(short *)));
|
return((short **) newcore((length+1) * sizeof(short *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*ARGSUSED1*/
|
||||||
oldmap(mp,length) short **mp, length; {
|
oldmap(mp,length) short **mp, length; {
|
||||||
oldcore((short *) mp, (length+1) * sizeof(short *));
|
oldcore((char *) mp, (length+1) * sizeof(short *));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,8 +205,9 @@ cset newbitvect(n) short n; {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*ARGSUSED1*/
|
||||||
oldbitvect(s,n) cset s; short n; {
|
oldbitvect(s,n) cset s; short n; {
|
||||||
oldcore((short *) s, (n-1)*sizeof(int) + sizeof(struct bitvector));
|
oldcore((char *) s, (n-1)*sizeof(int) + sizeof(struct bitvector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,8 +215,9 @@ short *newtable(length) short length; {
|
||||||
return((short *) newcore((length+1) * sizeof(short)));
|
return((short *) newcore((length+1) * sizeof(short)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*ARGSUSED1*/
|
||||||
oldtable(mp,length) short **mp, length; {
|
oldtable(mp,length) short **mp, length; {
|
||||||
oldcore((short *) mp, (length+1) * sizeof(short));
|
oldcore((char *) mp, (length+1) * sizeof(short));
|
||||||
}
|
}
|
||||||
|
|
||||||
cond_p newcondtab(l) int l;
|
cond_p newcondtab(l) int l;
|
||||||
|
@ -226,17 +229,15 @@ oldcondtab(tab) cond_p tab;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; tab[i].mc_cond != DEFAULT; i++);
|
for (i = 0; tab[i].mc_cond != DEFAULT; i++);
|
||||||
oldcore((short *) tab,((i+1) * sizeof (struct cond_tab)));
|
oldcore((char *) tab,((i+1) * sizeof (struct cond_tab)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
short *myalloc(size) register size; {
|
char *myalloc(size) register size; {
|
||||||
register short *p,*q;
|
register char *p;
|
||||||
|
|
||||||
p = malloc(size);
|
p = calloc((unsigned) size, 1);
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
error("out of memory");
|
error("out of memory");
|
||||||
for(q=p;size>0;size -= sizeof(short))
|
|
||||||
*q++ = 0;
|
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,16 +9,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
extern short *newcore();
|
extern char *newcore();
|
||||||
extern oldcore();
|
extern oldcore();
|
||||||
#else
|
#else
|
||||||
extern short *myalloc();
|
extern char *myalloc();
|
||||||
#define newcore(size) myalloc(size)
|
#define newcore(size) myalloc(size)
|
||||||
#define oldcore(p,size) free(p)
|
#define oldcore(p,size) free((char *)p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define newstruct(t) (newcore (sizeof (struct t)))
|
#define newstruct(t) ((struct t *) newcore (sizeof (struct t)))
|
||||||
#define oldstruct(t,p) oldcore((short *) p,sizeof (struct t))
|
#define oldstruct(t,p) oldcore((char *) p,sizeof (struct t))
|
||||||
|
|
||||||
extern line_p newline(); /* (byte optype) */
|
extern line_p newline(); /* (byte optype) */
|
||||||
extern arg_p newarg(); /* (byte argtype) */
|
extern arg_p newarg(); /* (byte argtype) */
|
||||||
|
|
|
@ -441,7 +441,7 @@ message(lnp)
|
||||||
case ms_reg:
|
case ms_reg:
|
||||||
if (ARG(lnp)->a_next != (arg_p) 0) {
|
if (ARG(lnp)->a_next != (arg_p) 0) {
|
||||||
/* take only "mes 3" with further arguments */
|
/* take only "mes 3" with further arguments */
|
||||||
Ladd(lnp,&mesregs);
|
Ladd((Lelem_t) lnp,&mesregs);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ms_err:
|
case ms_err:
|
||||||
|
@ -546,7 +546,7 @@ bool getunit(gf,lf,kind_out,g_out,l_out,p_out,collect_mes)
|
||||||
lp->lp_level = getshort(); /* nesting level */
|
lp->lp_level = getshort(); /* nesting level */
|
||||||
lp->lp_entry = getblock(getshort()); /* entry block of the loop */
|
lp->lp_entry = getblock(getshort()); /* entry block of the loop */
|
||||||
lp->lp_end = getblock(getshort()); /* tail of back edge of loop */
|
lp->lp_end = getblock(getshort()); /* tail of back edge of loop */
|
||||||
Ladd(lp,&curproc->p_loops);
|
Ladd((Lelem_t)lp,&curproc->p_loops);
|
||||||
}
|
}
|
||||||
*g_out = head;
|
*g_out = head;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -118,6 +118,7 @@ Lindex Lfirst(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*ARGSUSED1*/
|
||||||
Lindex Lnext(i,s)
|
Lindex Lnext(i,s)
|
||||||
Lindex i;
|
Lindex i;
|
||||||
lset s;
|
lset s;
|
||||||
|
|
|
@ -110,7 +110,7 @@ STATIC outint(i)
|
||||||
outshort(i);
|
outshort(i);
|
||||||
} else {
|
} else {
|
||||||
assert (sizeof(int) == sizeof(offset));
|
assert (sizeof(int) == sizeof(offset));
|
||||||
outoff(i);
|
outoff((offset) i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ putdtable(head,df)
|
||||||
}
|
}
|
||||||
fclose(curoutp);
|
fclose(curoutp);
|
||||||
if (omap != (obj_p *) 0) {
|
if (omap != (obj_p *) 0) {
|
||||||
oldmap(omap,olength); /* release memory for omap */
|
oldmap((short **) omap,olength); /* release memory for omap */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ putptable(head,pf,all)
|
||||||
}
|
}
|
||||||
fclose(curoutp);
|
fclose(curoutp);
|
||||||
if (pmap != (proc_p *) 0) {
|
if (pmap != (proc_p *) 0) {
|
||||||
oldmap(pmap,plength); /* release memory for pmap */
|
oldmap((short **) pmap,plength); /* release memory for pmap */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,9 +434,9 @@ putunit(kind,p,l,gf,lf)
|
||||||
oldbblock(b);
|
oldbblock(b);
|
||||||
}
|
}
|
||||||
/* Release the memory for the lmap, lbmap, bmap, lpmap tables */
|
/* Release the memory for the lmap, lbmap, bmap, lpmap tables */
|
||||||
if (lmap != (line_p *) 0) oldmap(lmap,llength);
|
if (lmap != (line_p *) 0) oldmap((short **) lmap,llength);
|
||||||
if (lbmap != (bblock_p *) 0) oldmap(lbmap,llength);
|
if (lbmap != (bblock_p *) 0) oldmap((short **) lbmap,llength);
|
||||||
if (bmap != (bblock_p *) 0) oldmap(bmap,blength);
|
if (bmap != (bblock_p *) 0) oldmap((short **) bmap,blength);
|
||||||
if (lpmap != (loop_p *) 0) oldmap(lpmap,lplength);
|
if (lpmap != (loop_p *) 0) oldmap((short **) lpmap,lplength);
|
||||||
curoutp = lf;
|
curoutp = lf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,6 @@ error(s,a) char *s,*a; {
|
||||||
fprintf(stderr,": ");
|
fprintf(stderr,": ");
|
||||||
fprintf(stderr,s,a);
|
fprintf(stderr,s,a);
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
abort();
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,7 @@ union pext_t {
|
||||||
#define IS_CALLED_IN_LOOP(p) (p->p_flags1 & PF_CALINLOOP)
|
#define IS_CALLED_IN_LOOP(p) (p->p_flags1 & PF_CALINLOOP)
|
||||||
#define IS_ENTERED_WITH_GTO(p) (p->p_flags1 & PF_GTO)
|
#define IS_ENTERED_WITH_GTO(p) (p->p_flags1 & PF_GTO)
|
||||||
#define ENTERED_WITH_GTO(p) p->p_flags1 |= PF_GTO
|
#define ENTERED_WITH_GTO(p) p->p_flags1 |= PF_GTO
|
||||||
|
#define BODY_KNOWN(p) (p->p_flags1 & (byte) PF_BODYSEEN)
|
||||||
|
|
||||||
|
|
||||||
/* LOOPS */
|
/* LOOPS */
|
||||||
|
@ -212,6 +213,7 @@ struct use {
|
||||||
#define CF_INDIR 01
|
#define CF_INDIR 01
|
||||||
#define UF_INDIR 01
|
#define UF_INDIR 01
|
||||||
|
|
||||||
|
#define CHANGE_INDIR(p) (p->p_change->c_flags & CF_INDIR)
|
||||||
|
|
||||||
/* SETS */
|
/* SETS */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue