dynamic table sizes, commons in ranlib table
This commit is contained in:
parent
16082b9056
commit
7d2f8e4d3e
1 changed files with 27 additions and 13 deletions
|
@ -30,16 +30,15 @@ static char RcsId[] = "$Header$";
|
||||||
#include <out.h>
|
#include <out.h>
|
||||||
#define MAGIC_NUMBER AALMAG
|
#define MAGIC_NUMBER AALMAG
|
||||||
#ifdef AAL
|
#ifdef AAL
|
||||||
#define TABSZ 2000 /* maximum # of ranlib table entries */
|
|
||||||
#define STRTABSZ 8*TABSZ /* maximum size of string table */
|
|
||||||
long offset;
|
long offset;
|
||||||
struct ranlib tab[TABSZ];
|
struct ranlib *tab;
|
||||||
long tnum = 0;
|
long tnum = 0;
|
||||||
char tstrtab[STRTABSZ];
|
char *tstrtab;
|
||||||
long tssiz = 0;
|
long tssiz = 0;
|
||||||
char *malloc(), *strcpy(), *strncpy();
|
char *malloc(), *realloc(), *strcpy(), *strncpy();
|
||||||
long lseek();
|
long lseek();
|
||||||
long time();
|
long time();
|
||||||
|
unsigned int tabsz, strtabsz;
|
||||||
#endif AAL
|
#endif AAL
|
||||||
#else
|
#else
|
||||||
#define MAGIC_NUMBER ARMAG
|
#define MAGIC_NUMBER ARMAG
|
||||||
|
@ -233,6 +232,13 @@ char *argv[];
|
||||||
) {
|
) {
|
||||||
mktemp(temp_arch);
|
mktemp(temp_arch);
|
||||||
}
|
}
|
||||||
|
#ifdef AAL
|
||||||
|
tab = (struct ranlib *) malloc(512 * sizeof(struct ranlib));
|
||||||
|
tstrtab = malloc(4096);
|
||||||
|
if (!tab || !tstrtab) error(TRUE,"Out of core\n");
|
||||||
|
tabsz = 512;
|
||||||
|
strtabsz = 4096;
|
||||||
|
#endif
|
||||||
|
|
||||||
signal(SIGINT, catch);
|
signal(SIGINT, catch);
|
||||||
get(argc, argv);
|
get(argc, argv);
|
||||||
|
@ -665,11 +671,14 @@ do_names(headp)
|
||||||
p->on_mptr = xxx + p->on_foff;
|
p->on_mptr = xxx + p->on_foff;
|
||||||
/*
|
/*
|
||||||
* Only enter names that are exported and are really
|
* Only enter names that are exported and are really
|
||||||
* defined.
|
* defined. Also enter common names. Note, that
|
||||||
|
* this might cause problems when the name is really
|
||||||
|
* defined in a later file, with a value != 0.
|
||||||
|
* However, this problem also exists on the Unix
|
||||||
|
* ranlib archives.
|
||||||
*/
|
*/
|
||||||
if ( (p->on_type & S_EXT) &&
|
if ( (p->on_type & S_EXT) &&
|
||||||
(p->on_type & S_TYP) != S_UND &&
|
(p->on_type & S_TYP) != S_UND
|
||||||
!(p->on_type & S_COM)
|
|
||||||
)
|
)
|
||||||
enter_name(p);
|
enter_name(p);
|
||||||
p++;
|
p++;
|
||||||
|
@ -683,16 +692,21 @@ enter_name(namep)
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
|
||||||
if (tnum >= TABSZ) {
|
if (tnum >= tabsz) {
|
||||||
error(TRUE, "symbol table overflow\n");
|
tab = (struct ranlib *)
|
||||||
|
realloc((char *) tab, (tabsz += 512) * sizeof(struct ranlib));
|
||||||
|
if (! tab) error(TRUE, "Out of core\n");
|
||||||
}
|
}
|
||||||
tab[tnum].ran_off = tssiz;
|
tab[tnum].ran_off = tssiz;
|
||||||
tab[tnum].ran_pos = offset;
|
tab[tnum].ran_pos = offset;
|
||||||
|
|
||||||
for (cp = namep->on_mptr; tstrtab[tssiz++] = *cp++;)
|
for (cp = namep->on_mptr; *cp; cp++) {
|
||||||
if (tssiz >= STRTABSZ) {
|
if (tssiz >= strtabsz) {
|
||||||
error(TRUE, "string table overflow\n");
|
tstrtab = realloc(tstrtab, (strtabsz += 4096));
|
||||||
|
if (! tstrtab) error(TRUE, "string table overflow\n");
|
||||||
}
|
}
|
||||||
|
tstrtab[tssiz++] = *cp;
|
||||||
|
}
|
||||||
tnum++;
|
tnum++;
|
||||||
}
|
}
|
||||||
#endif AAL
|
#endif AAL
|
||||||
|
|
Loading…
Add table
Reference in a new issue