loader: code motion.

This commit is contained in:
Adam Jackson 2009-01-26 07:50:00 -05:00
parent 28b6b1519c
commit 499908aeca

View File

@ -83,8 +83,36 @@ static int refCount[MAX_HANDLE];
static int moduleseq = 0; static int moduleseq = 0;
/* Prototypes for static functions. */ /* Prototypes for static functions. */
static loaderPtr _LoaderListPush(void); static loaderPtr listHead = NULL;
static loaderPtr _LoaderListPop(int);
static loaderPtr
_LoaderListPush(void)
{
loaderPtr item = calloc(1, sizeof(struct _loader));
item->next = listHead;
listHead = item;
return item;
}
static loaderPtr
_LoaderListPop(int handle)
{
loaderPtr item = listHead;
loaderPtr *bptr = &listHead; /* pointer to previous node */
while (item) {
if (item->handle == handle) {
*bptr = item->next; /* remove this from the list */
return item;
}
bptr = &(item->next);
item = item->next;
}
return 0;
}
void void
LoaderInit(void) LoaderInit(void)
@ -139,37 +167,6 @@ LoaderInit(void)
#endif #endif
} }
static loaderPtr listHead = (loaderPtr) 0;
static loaderPtr
_LoaderListPush(void)
{
loaderPtr item = calloc(1, sizeof(struct _loader));
item->next = listHead;
listHead = item;
return item;
}
static loaderPtr
_LoaderListPop(int handle)
{
loaderPtr item = listHead;
loaderPtr *bptr = &listHead; /* pointer to previous node */
while (item) {
if (item->handle == handle) {
*bptr = item->next; /* remove this from the list */
return item;
}
bptr = &(item->next);
item = item->next;
}
return 0;
}
/* These four are just ABI stubs */ /* These four are just ABI stubs */
void void
LoaderRefSymbols(const char *sym0, ...) LoaderRefSymbols(const char *sym0, ...)