Use IsMinListEmpty() for MinList rather than IsListEmpty().

This removes the warnings about breaking the strict-aliasing rules.
This commit is contained in:
Sebastian Bauer 2018-04-10 23:20:20 +02:00
parent 85c36839d5
commit 397013922c
8 changed files with 23 additions and 15 deletions

View File

@ -125,7 +125,7 @@ CLIB_DESTRUCTOR(dirent_exit)
if(__directory_list.mlh_Head != NULL)
{
while(NOT IsListEmpty((struct List *)&__directory_list))
while(NOT IsMinListEmpty(&__directory_list))
closedir((DIR *)__directory_list.mlh_Head);
}

View File

@ -196,7 +196,7 @@ opendir(const char * path_name)
UnLockDosList(LDF_VOLUMES|LDF_READ);
/* Bail out if we cannot present anything. */
if(IsListEmpty((struct List *)&dh->dh_VolumeList))
if(IsMinListEmpty(&dh->dh_VolumeList))
{
__set_errno(ENOMEM);
goto out;

View File

@ -93,7 +93,7 @@ readdir(DIR * directory_pointer)
assert( (((ULONG)name) & 3) == 0 );
if(dh->dh_VolumeNode == NULL && NOT IsListEmpty((struct List *)&dh->dh_VolumeList))
if(dh->dh_VolumeNode == NULL && NOT IsMinListEmpty(&dh->dh_VolumeList))
dh->dh_VolumeNode = (struct Node *)dh->dh_VolumeList.mlh_Head;
strcpy(name,"\1:"); /* BSTR for ":" */

View File

@ -93,6 +93,13 @@
/****************************************************************************/
#ifndef IsMinListEmpty
#define IsMinListEmpty(ml) \
((struct MinList *)((ml)->mlh_TailPred) == (struct MinList *)(ml))
#endif
/****************************************************************************/
#ifndef AMIGA_COMPILER_H
#ifdef __SASC

View File

@ -327,7 +327,7 @@ remove_locked_region_node(struct FileLockSemaphore * fls,struct fd * fd,LONG sta
/* Check if there are any locked regions left.
* If not, mark the entire file as unlocked.
*/
if(IsListEmpty((struct List *)&which_lock->fln_LockedRegionList))
if(IsMinListEmpty(&which_lock->fln_LockedRegionList))
{
SHOWMSG("no more regions are locked; removing the file lock node");
@ -705,7 +705,7 @@ cleanup_locked_records(struct fd * fd)
}
}
if(IsListEmpty((struct List *)&which_lock->fln_LockedRegionList))
if(IsMinListEmpty(&which_lock->fln_LockedRegionList))
{
SHOWMSG("no more regions are locked; removing the file lock node");

View File

@ -94,7 +94,7 @@ alloca_cleanup(const char * file,int line)
NewList((struct List *)&alloca_memory_list);
/* Is this worth cleaning up? */
if(NOT IsListEmpty((struct List *)&alloca_memory_list))
if(NOT IsMinListEmpty(&alloca_memory_list))
{
struct MemoryContextNode * mcn_prev;
struct MemoryContextNode * mcn;
@ -120,7 +120,7 @@ alloca_cleanup(const char * file,int line)
/* Drop the cleanup callback if there's nothing to be cleaned
up any more. */
if(IsListEmpty((struct List *)&alloca_memory_list))
if(IsMinListEmpty(&alloca_memory_list))
__alloca_cleanup = NULL;
}

View File

@ -75,14 +75,15 @@ struct MinList NOCOMMON __memory_list;
/****************************************************************************/
void *
__allocate_memory(size_t size,BOOL never_free,const char * UNUSED debug_file_name,int UNUSED debug_line_number)
__allocate_memory(size_t size,BOOL never_free,const char *debug_file_name UNUSED,int debug_line_number UNUSED)
{
struct MemoryNode * mn;
size_t allocation_size;
void * result = NULL;
size_t original_size;
#if defined(UNIX_PATH_SEMANTICS)
size_t original_size;
{
original_size = size;
@ -417,7 +418,7 @@ STDLIB_DESTRUCTOR(stdlib_memory_exit)
if(__memory_list.mlh_Head != NULL)
{
while(NOT IsListEmpty((struct List *)&__memory_list))
while(NOT IsMinListEmpty(&__memory_list))
{
((struct MemoryNode *)__memory_list.mlh_Head)->mn_AlreadyFree = FALSE;
@ -453,12 +454,12 @@ STDLIB_DESTRUCTOR(stdlib_memory_exit)
{
#ifdef __MEM_DEBUG
{
while(NOT IsListEmpty((struct List *)&__memory_list))
while(NOT IsMinListEmpty(&__memory_list))
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
}
#else
{
while(NOT IsListEmpty((struct List *)&__memory_list))
while(NOT IsMinListEmpty(&__memory_list))
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,NULL,0);
}
#endif /* __MEM_DEBUG */
@ -478,12 +479,12 @@ STDLIB_DESTRUCTOR(stdlib_memory_exit)
{
#ifdef __MEM_DEBUG
{
while(NOT IsListEmpty((struct List *)&__memory_list))
while(NOT IsMinListEmpty(&__memory_list))
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
}
#else
{
while(NOT IsListEmpty((struct List *)&__memory_list))
while(NOT IsMinListEmpty(&__memory_list))
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,NULL,0);
}
#endif /* __MEM_DEBUG */

View File

@ -69,7 +69,7 @@ CLIB_DESTRUCTOR(unistd_exit)
PROFILE_OFF();
if(__unlink_list.mlh_Head != NULL && NOT IsListEmpty((struct List *)&__unlink_list))
if(__unlink_list.mlh_Head != NULL && NOT IsMinListEmpty(&__unlink_list))
{
struct UnlinkNode * uln;
BPTR old_dir;