IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 27, 2007, 1:14:35 PM (19 years ago)
Author:
jhoblitt
Message:

add psMemIsAlloced()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psAssert.h

    r12596 r14676  
    2020}
    2121
    22 // Ensure this is a psLib pointer, by checking for the memblock bounds.
    23 #define PS_ASSERT_PTR(NAME, RVAL) \
     22// Ensure this is a psLib pointer
     23#define PS_ASSERT_PTR(PTR, RVAL) \
    2424{ \
    25     if (NAME == NULL) return(RVAL); \
    26     psMemBlock *mb = (psMemBlock*)(NAME) - 1; \
    27     if (mb->startblock != P_PS_MEMMAGIC || mb->endblock != P_PS_MEMMAGIC || \
    28             *(psU32 *)((char *)(mb + 1) + mb->userMemorySize) != P_PS_MEMMAGIC) { \
     25    if (PTR == NULL) return RVAL; \
     26    if (!psMemIsAlloced(PTR)) { \
    2927        psError(PS_ERR_MEMORY_CORRUPTION, false, \
    30                 "Error: Pointer %s is corrupted or not on the PS memory system.", \
    31                 #NAME); \
    32         return (RVAL); \
     28            "Error: Pointer %p is corrupted or not on the PS memory system.", \
     29            PTR); \
     30        return RVAL; \
    3331    } \
    3432}
Note: See TracChangeset for help on using the changeset viewer.