IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 9, 2004, 1:40:55 PM (22 years ago)
Author:
desonia
Message:

fixed indent-madness concerning preprocessor directives.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sysUtils/psMemory.h

    r1440 r1441  
    11#if !defined(PS_MEMORY_H)
    2 #    define PS_MEMORY_H
     2#define PS_MEMORY_H
    33
    44/** @file  psMemory.h
     
    1515 *  @ingroup MemoryManagement
    1616 *
    17  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    18  *  @date $Date: 2004-08-09 23:34:58 $
     17 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     18 *  @date $Date: 2004-08-09 23:40:55 $
    1919 *
    2020 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    2121 */
    2222
    23 #    include <stdio.h>                     // needed for FILE
    24 #    include <stdbool.h>
    25 #    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
     23#include <stdio.h>                     // needed for FILE
     24#include <stdbool.h>
     25#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
    2626
    2727/** @addtogroup MemoryManagement
     
    122122 *  @see psFree
    123123 */
    124 #    ifdef DOXYGEN
     124#ifdef DOXYGEN
    125125void *psAlloc(size_t size       ///< Size required
    126126             );
    127 #    else
    128 
    129     void *p_psAlloc(size_t size,    ///< Size required
    130                     const char *file,       ///< File of call
    131                     int lineno      ///< Line number of call
    132                    );
     127#else
     128
     129void *p_psAlloc(size_t size,    ///< Size required
     130                const char *file,       ///< File of call
     131                int lineno      ///< Line number of call
     132               );
    133133
    134134void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
     
    136136
    137137/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    138 #        define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
    139 #    endif
     138#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
     139#endif
    140140
    141141/** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
     
    144144 *  @see psAlloc, psFree
    145145 */
    146 #    ifdef DOXYGEN
     146#ifdef DOXYGEN
    147147void *psRealloc(void *ptr       ///< Pointer to re-allocate
    148148                size_t size,    ///< Size required
    149149               );
    150 #    else
    151 
    152     void *p_psRealloc(void *ptr,    ///< Pointer to re-allocate
    153                       size_t size,  ///< Size required
    154                       const char *file,     ///< File of call
    155                       int lineno    ///< Line number of call
    156                      );
     150#else
     151
     152void *p_psRealloc(void *ptr,    ///< Pointer to re-allocate
     153                  size_t size,  ///< Size required
     154                  const char *file,     ///< File of call
     155                  int lineno    ///< Line number of call
     156                 );
    157157
    158158/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
    159 #        define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
    160 
    161 #    endif
     159#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
     160
     161#endif
    162162
    163163/** Free memory.  This operates much like free().
     
    165165 *  @see psAlloc, psRealloc
    166166 */
    167 #    ifdef DOXYGEN
     167#ifdef DOXYGEN
    168168void psFree(void *ptr,          ///< Pointer to free, if NULL, function returns immediately.
    169169           );
    170 #    else
    171 
    172     void p_psFree(void *ptr,        ///< Pointer to free
    173                   const char *file, ///< File of call
    174                   int lineno        ///< Line number of call
    175                  );
     170#else
     171
     172void p_psFree(void *ptr,        ///< Pointer to free
     173              const char *file, ///< File of call
     174              int lineno        ///< Line number of call
     175             );
    176176
    177177/// Free memory.  psFree sends file and line number to p_psFree.
    178 #        define psFree(size) p_psFree(size, __FILE__, __LINE__)
    179 
    180 #    endif
     178#define psFree(size) p_psFree(size, __FILE__, __LINE__)
     179
     180#endif
    181181
    182182/** Check for memory leaks.  This scans for allocated memory buffers not freed with an ID not less than id0.
     
    218218 *  @ingroup memRefCount
    219219 */
    220 #    ifdef DOXYGEN
     220#ifdef DOXYGEN
    221221void *psMemIncrRefCounter(void *vptr    ///< Pointer to increment refCounter, and return
    222222                         );
    223 #    else
    224 
    225     void *p_psMemIncrRefCounter(void *vptr, ///< Pointer to increment refCounter, and return
    226                                 const char *file,   ///< File of call
    227                                 int lineno  ///< Line number of call
    228                                );
    229 
    230 #        define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
    231 #    endif
     223#else
     224
     225void *p_psMemIncrRefCounter(void *vptr, ///< Pointer to increment refCounter, and return
     226                            const char *file,   ///< File of call
     227                            int lineno  ///< Line number of call
     228                           );
     229
     230#define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
     231#endif
    232232
    233233/** Decrement reference counter and return the pointer
     
    235235 *  @ingroup memRefCount
    236236 */
    237 #    ifdef DOXYGEN
     237#ifdef DOXYGEN
    238238void *psMemDecrRefCounter(void *vptr    ///< Pointer to decrement refCounter, and return
    239239                         );
    240 #    else
    241 
    242     void *p_psMemDecrRefCounter(void *vptr, ///< Pointer to decrement refCounter, and return
    243                                 const char *file,   ///< File of call
    244                                 int lineno  ///< Line number of call
    245                                );
    246 
    247 #        define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
    248 #    endif
     240#else
     241
     242void *p_psMemDecrRefCounter(void *vptr, ///< Pointer to decrement refCounter, and return
     243                            const char *file,   ///< File of call
     244                            int lineno  ///< Line number of call
     245                           );
     246
     247#define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
     248#endif
    249249
    250250/** Set callback for problems
     
    297297//@} End of Memory Management Functions
    298298
    299 #    ifndef DOXYGEN
     299#ifndef DOXYGEN
    300300
    301301/*
    302302 * Ensure that any program using malloc/realloc/free will fail to compile
    303303 */
    304 #        ifndef PS_ALLOW_MALLOC
    305 #            ifdef __GNUC__
    306 #                pragma GCC poison malloc realloc calloc free
    307 #            else
    308     #                define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
    309     #                define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
    310     #                define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
    311     #                define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
    312     #            endif
    313     #        endif
    314 
    315     #    endif
    316     // doxygen skip
    317 
    318     #endif // end of header file
     304#ifndef PS_ALLOW_MALLOC
     305#ifdef __GNUC__
     306#pragma GCC poison malloc realloc calloc free
     307#else
     308#                define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
     309#                define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
     310#                define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
     311#                define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
     312#            endif
     313#        endif
     314
     315#    endif
     316// doxygen skip
     317
     318#endif // end of header file
Note: See TracChangeset for help on using the changeset viewer.