mirror of
https://github.com/fachat/xa65.git
synced 2025-01-01 10:29:19 +00:00
small cleanups
This commit is contained in:
parent
0bb027f032
commit
91ace0a6bf
20
xa/src/xa.c
20
xa/src/xa.c
@ -676,21 +676,15 @@ static int pass2(void)
|
||||
} else
|
||||
if(afile->mn.tmp[afile->mn.tmpe]==T_FILE)
|
||||
{
|
||||
// copy the current line number from the current file descriptor
|
||||
datei.fline=(afile->mn.tmp[afile->mn.tmpe+1]&255)+(afile->mn.tmp[afile->mn.tmpe+2]<<8);
|
||||
|
||||
// copy the pointer to the file name in the current file descriptor
|
||||
// Note: the filename in the current file descriptor is separately malloc'd and
|
||||
// thus save to store the pointer
|
||||
memcpy(&datei.fname, afile->mn.tmp+afile->mn.tmpe+3, sizeof(datei.fname));
|
||||
afile->mn.tmpe+=3+sizeof(datei.fname);
|
||||
|
||||
list_filename(datei.fname); /* set file name of next listing output */
|
||||
/*
|
||||
datei.fname = malloc(strlen((char*) afile->mn.tmp+afile->mn.tmpe+3)+1);
|
||||
if(!datei.fname) {
|
||||
fprintf(stderr,"Oops, no more memory\n");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(datei.fname,(char*) afile->mn.tmp+afile->mn.tmpe+3);
|
||||
afile->mn.tmpe+=3+strlen(datei.fname);
|
||||
*/
|
||||
}
|
||||
} else
|
||||
{
|
||||
@ -1083,7 +1077,7 @@ static int getline(char *s)
|
||||
puttmp(T_LINE);
|
||||
puttmp((filep->fline)&255);
|
||||
puttmp(((filep->fline)>>8)&255);
|
||||
ec=E_OK;
|
||||
ec=E_OK;
|
||||
|
||||
}
|
||||
else
|
||||
@ -1094,10 +1088,6 @@ static int getline(char *s)
|
||||
puttmp((filep->fline)&255);
|
||||
puttmp(((filep->fline)>>8)&255);
|
||||
puttmps((signed char*)&(filep->fname), sizeof(filep->fname));
|
||||
/*
|
||||
puttmps((signed char*)filep->fname,
|
||||
1+(int)strlen(filep->fname));
|
||||
*/
|
||||
ec=E_OK;
|
||||
}
|
||||
} while(!ec && l[i]=='\0');
|
||||
|
@ -221,8 +221,11 @@ typedef struct File {
|
||||
int base[SEG_MAX];
|
||||
int len[SEG_MAX];
|
||||
struct {
|
||||
// temporary memory between pass1 and pass2
|
||||
signed char *tmp;
|
||||
// write pointer
|
||||
unsigned long tmpz;
|
||||
// read pointer
|
||||
unsigned long tmpe;
|
||||
} mn;
|
||||
struct {
|
||||
|
13
xa/src/xap.c
13
xa/src/xap.c
@ -753,14 +753,16 @@ int pp_open(char *name)
|
||||
|
||||
fp=xfopen(name,"r");
|
||||
|
||||
int l = strlen(name);
|
||||
|
||||
/* we have to alloc it dynamically to make the name survive another
|
||||
pp_open - it's used in the cross-reference list */
|
||||
flist[0].fname = malloc(strlen(name)+1);
|
||||
flist[0].fname = malloc(l+1);
|
||||
if(!flist[0].fname) {
|
||||
fprintf(stderr,"Oops, no more memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
(void)strcpy(flist[0].fname,name);
|
||||
(void)strncpy(flist[0].fname,name,l+1);
|
||||
flist[0].fline=0;
|
||||
flist[0].bdepth=b_depth();
|
||||
flist[0].filep=fp;
|
||||
@ -827,14 +829,17 @@ int icl_open(char *tt)
|
||||
|
||||
fsp++;
|
||||
|
||||
char *namep = s+i;
|
||||
int len = strlen(namep);
|
||||
|
||||
/* we have to alloc it dynamically to make the name survive another
|
||||
pp_open - it's used in the cross-reference list */
|
||||
flist[fsp].fname = malloc(strlen(s+i)+1);
|
||||
flist[fsp].fname = malloc(len+1);
|
||||
if(!flist[fsp].fname) {
|
||||
fprintf(stderr,"Oops, no more memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(flist[fsp].fname,s+i);
|
||||
strncpy(flist[fsp].fname,namep, len+1);
|
||||
flist[fsp].fline=0;
|
||||
flist[fsp].bdepth=b_depth();
|
||||
flist[fsp].flinep=NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user