inpcom.c: add fcn delete_libs to free libraries[]
This commit is contained in:
parent
fe7a61c612
commit
750b42e767
|
|
@ -261,6 +261,7 @@ read_a_lib(char *y, int call_depth, char *dir_name)
|
|||
dir_name_flag = TRUE;
|
||||
}
|
||||
|
||||
/* lib points to a new entry in global lib array libraries[N_LIBRARIES] */
|
||||
lib = new_lib();
|
||||
|
||||
lib->name = strdup(y);
|
||||
|
|
@ -281,6 +282,24 @@ read_a_lib(char *y, int call_depth, char *dir_name)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* remove all library entries from global libraries[] */
|
||||
static void
|
||||
delete_libs(void)
|
||||
{
|
||||
int i;
|
||||
struct line *tmpdeck, *tmpdeck2;
|
||||
for (i = 0; i < N_LIBRARIES; i++) {
|
||||
if (libraries[i].name == NULL)
|
||||
continue;
|
||||
tfree(libraries[i].name);
|
||||
tmpdeck = libraries[i].deck;
|
||||
while (tmpdeck) { /* cannot use line_free_x(tmpdeck, TRUE); due to stack overflow */
|
||||
tmpdeck2 = tmpdeck;
|
||||
tmpdeck = tmpdeck->li_next;
|
||||
line_free_x(tmpdeck2, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct names *
|
||||
new_names(void)
|
||||
|
|
@ -554,8 +573,9 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
|
|||
*buffer = '*'; /* change .TITLE line to comment line */
|
||||
}
|
||||
|
||||
/* now handle .lib statements */
|
||||
if (ciprefix(".lib", buffer)) {
|
||||
/* now handle old style .lib entries */
|
||||
/* new style .lib entries handling is in expand_section_references() */
|
||||
if (ciprefix(".lib", buffer))
|
||||
if (inp_compat_mode == COMPATMODE_PS) {
|
||||
/* compatibility mode,
|
||||
* this is neither a libray section definition nor a reference
|
||||
|
|
@ -567,8 +587,6 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
|
|||
memcpy(buffer, ".inc", 4);
|
||||
}
|
||||
|
||||
} /* end of .lib handling */
|
||||
|
||||
/* now handle .include statements */
|
||||
if (ciprefix(".include", buffer) || ciprefix(".inc", buffer)) {
|
||||
|
||||
|
|
@ -680,10 +698,11 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
|
|||
!ciprefix("load", buffer)
|
||||
)
|
||||
{
|
||||
/* lower case for all lines (exceptions see above!) */
|
||||
for (s = buffer; *s && (*s != '\n'); s++)
|
||||
*s = (char) tolower(*s);
|
||||
} else {
|
||||
// exclude some commands to preserve filename case
|
||||
/* exclude some commands to preserve filename case */
|
||||
for (s = buffer; *s && (*s != '\n'); s++)
|
||||
;
|
||||
}
|
||||
|
|
@ -2516,6 +2535,7 @@ expand_section_references(struct line *c, int call_depth, char *dir_name)
|
|||
}
|
||||
|
||||
}
|
||||
delete_libs();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue