dz80/dissz80.c
/* Release allocated memory, close open files, etc.. */
Release allocated memory, close open files, etc
Release allocated memory close open files etc
void DisZ80CleanUp(DISZ80 *d)
{
	int 		i;
	DISREF		*dr, *drLast;
	DISREFADDR	*ra, *raLast;
	assert(d != NULL);
	if (d->outStream != NULL)
		{
		fclose(d->outStream);
		d->outStream =	NULL;
		}
	for(i=0; i < DISREF_TOTAL; i++)
		{
		dr = d->pRefHead[i];
		while(dr != NULL)
			{
			ra = dr->pRefAddrHead;
			while (ra != NULL)
				{
				raLast = ra;
				ra = ra->pNext;
				free(raLast);
				}
			drLast = dr;
			dr = dr->pNext;
			free(drLast);
			}
		d->pRefHead[i] = NULL;
		}
	if (d->opMap != NULL)
		{
		free(d->opMap);
		d->opMap = NULL;
		}
	if (d->fnMap != NULL)
		{
		free(d->fnMap);
		d->fnMap = NULL;
		}
	if (d->pTrapMap != NULL)
		{
		free(d->pTrapMap);
		d->pTrapMap = NULL;
		}
	ShutdownScripting(d);
	return;
}
void DisZ80CleanUp ( DISZ80 * d ) { int i ; DISREF * dr , * drLast ; DISREFADDR * ra , * raLast ; assert ( d != NULL ) ; if ( d -> outStream != NULL ) { fclose ( d -> outStream ) ; d -> outStream = NULL ; } for ( i = 0 ; i < DISREF_TOTAL ; i ++ ) { dr = d -> pRefHead [ i ] ; while ( dr != NULL ) { ra = dr -> pRefAddrHead ; while ( ra != NULL ) { raLast = ra ; ra = ra -> pNext ; free ( raLast ) ; } drLast = dr ; dr = dr -> pNext ; free ( drLast ) ; } d -> pRefHead [ i ] = NULL ; } if ( d -> opMap != NULL ) { free ( d -> opMap ) ; d -> opMap = NULL ; } if ( d -> fnMap != NULL ) { free ( d -> fnMap ) ; d -> fnMap = NULL ; } if ( d -> pTrapMap != NULL ) { free ( d -> pTrapMap ) ; d -> pTrapMap = NULL ; } ShutdownScripting ( d ) ; return ; }
Release allocated memory, close open files, etc..
Release allocated memory close open files etc ..