Skip to content

Commit

Permalink
Cleaning up #ifdefs that split up parts of statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviomotamedeiros committed Nov 20, 2015
1 parent 52147bb commit 89730d4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/tk/mem.c
Expand Up @@ -457,6 +457,7 @@ void *mem_calloc_debug(size_t n, const char *fil, int lin)
void mem_free_debug(void *ptr, const char *fil, int lin)
{
struct mem_debug *dl;
int error;

if (ptr == NULL)
return;
Expand All @@ -472,10 +473,11 @@ void mem_free_debug(void *ptr, const char *fil, int lin)
goto err2;
}
#if SUN || SUN386 /* Bus error if we read a long from an odd address */
if (memcmp(&dl->data[dl->Mnbytes],&afterval,sizeof(AFTERVAL)) != 0)
error = (memcmp(&dl->data[dl->Mnbytes],&afterval,sizeof(AFTERVAL)) != 0);
#else
if (*(long *) &dl->data[dl->Mnbytes] != AFTERVAL)
error = (*(long *) &dl->data[dl->Mnbytes] != AFTERVAL);
#endif
if (error)
{
PRINT "Pointer x%lx overrun\n",(long)ptr);
goto err2;
Expand Down Expand Up @@ -545,7 +547,8 @@ static void mem_checkdl(struct mem_debug *dl)
{ void *p;
#if (__SC__ || __DMC__) && !_WIN32
unsigned u;

int error;

/* Take advantage of fact that SC's allocator stores the size of the
* alloc in the unsigned immediately preceding the allocation.
*/
Expand All @@ -559,10 +562,11 @@ static void mem_checkdl(struct mem_debug *dl)
goto err2;
}
#if SUN || SUN386 /* Bus error if we read a long from an odd address */
if (memcmp(&dl->data[dl->Mnbytes],&afterval,sizeof(AFTERVAL)) != 0)
error = (memcmp(&dl->data[dl->Mnbytes],&afterval,sizeof(AFTERVAL)) != 0);
#else
if (*(long *) &dl->data[dl->Mnbytes] != AFTERVAL)
error = (*(long *) &dl->data[dl->Mnbytes] != AFTERVAL);
#endif
if (error)
{
PRINT "Pointer x%lx overrun\n",(long)p);
goto err2;
Expand Down

0 comments on commit 89730d4

Please sign in to comment.