Skip to content

Commit

Permalink
wlib: do code more transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed May 11, 2024
1 parent 1dd0d6c commit 2af569e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 2 additions & 0 deletions bld/nwlib/c/implib.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ static bool elfAddImport( libfile io, long header_offset, arch_header *arch )
arch->name = arch->ffname;

CloseORLObjFile( ofile );
MemFree( ofile );
return( true );
}

Expand Down Expand Up @@ -444,6 +445,7 @@ static void peAddImport( libfile io, long header_offset, arch_header *arch )
}

CloseORLObjFile( ofile );
MemFree( ofile );
}


Expand Down
16 changes: 7 additions & 9 deletions bld/nwlib/c/omfproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,9 @@ static void FreeCommonBlk( void )
{
common_blk *tmpblk;

while( CurrCommonBlk != NULL ) {
tmpblk = CurrCommonBlk->next;
MemFree( CurrCommonBlk );
CurrCommonBlk = tmpblk;
while( (tmpblk = CurrCommonBlk) != NULL ) {
CurrCommonBlk = tmpblk->next;
MemFree( tmpblk );
}
}

Expand Down Expand Up @@ -377,12 +376,11 @@ static void getalias( void )
static void FreeLNames( void )
/****************************/
{
lname *next;
lname *tmp;

while( LNames != NULL ) {
next = LNames->next;
MemFree( LNames );
LNames = next;
while( (tmp = LNames) != NULL ) {
LNames = tmp->next;
MemFree( tmp );
}
}

Expand Down
6 changes: 2 additions & 4 deletions bld/nwlib/c/orlrtns.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,14 @@ static void DoCloseORLObjFile( obj_file *ofile )
/**********************************************/
{
buf_list *list;
buf_list *next;

if( ofile->orl != NULL ) {
ORLFileFini( ofile->orl );
}
for( list = ofile->buflist; list != NULL; list = next ) {
next = list->next;
while( (list = ofile->buflist) != NULL ) {
ofile->buflist = list->next;
MemFree( list );
}
MemFree( ofile );
}

void CloseORLObjFile( obj_file *ofile )
Expand Down
1 change: 1 addition & 0 deletions bld/nwlib/c/symtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ void AddObjectSymbols( libfile io, long offset, arch_header *arch )
CurrFile->inlib = FindInLib( io );
ObjWalkSymList( ofile, CurrFile );
CloseORLLibFile( ofile );
MemFree( ofile );
}

void OmfMKImport( arch_header *arch, importType type,
Expand Down

0 comments on commit 2af569e

Please sign in to comment.