IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 15, 2004, 3:20:03 PM (22 years ago)
Author:
eugene
Message:

added Doxygen \file and \defgroup entries
some basic reorganization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psMemory.h

    r222 r247  
    11#if !defined(PS_MEMORY_H)
    22#define PS_MEMORY_H
    3 #include <stdio.h>
    4 /**
    5  * Book-keeping data for storage allocator.
    6  *
    7  * N.b. sizeof(psMemBlock) must be chosen such that if ptr is a pointer
    8  * returned by malloc, then ((char *)ptr + sizeof(psMemBlock)) is properly
    9  * aligned for all storage types.
     3
     4/** \file psMemory.h
     5 *  \brief Memory alloc/free routines
     6 *  \ingroup SystemGroup
     7 */
     8
     9/** Book-keeping data for storage allocator.
     10 *  N.b. sizeof(psMemBlock) must be chosen such that if ptr is a pointer
     11 *  returned by malloc, then ((char *)ptr + sizeof(psMemBlock)) is properly
     12 *  aligned for all storage types.
    1013 */
    1114typedef struct {
     
    1821} psMemBlock;
    1922
    20 /** */
     23/** prototype of a basic callback used by memory functions */
    2124typedef int (*psMemCallback)(const psMemBlock *ptr);
    22 typedef void (*psMemProblemCallback)(const psMemBlock *ptr,
    23                                      const char *file, int lineno);
     25
     26/** prototype of a callback used in error conditions */
     27typedef void (*psMemProblemCallback)(const psMemBlock *ptr, const char *file, int lineno);
     28
     29/** prototype of a callback used when memory runs out */
    2430typedef void *(*psMemExhaustedCallback)(size_t size);
    2531
    2632/*****************************************************************************/
    2733
    28 /** Fake for p_psAlloc */
    29 void *psAlloc(size_t size               //!< Size required
    30     );
    31 /** Fake for p_psRealloc */
    32 void *psRealloc(void *ptr,              //!< Pointer to re-allocate
    33                 size_t size             //!< Size required
    34     );
    35 /** Fake for p_psFree */
    36 void psFree(void *ptr                   //!< Pointer to free
    37     );
    38 
    39 /** Memory allocation */
     34/** Memory allocation. Underlying private function called by macro psAlloc. */
    4035void *p_psAlloc(size_t size,            //!< Size required
    4136                const char *file,       //!< File of call
     
    4338    );
    4439
    45 /** Memory re-allocation */
     40/** Memory re-allocation.  Underlying private function called by macro psRealloc. */
    4641void *p_psRealloc(void *ptr,            //!< Pointer to re-allocate
    4742                  size_t size,          //!< Size required
     
    5045    );
    5146
    52 /** Free memory */
     47/** Free memory.  Underlying private function called by macro psFree. */
    5348void p_psFree(void *ptr,                //!< Pointer to free
    5449              const char *file,         //!< File of call
     
    5651    );
    5752
    58 /** psAlloc sends file and line number to p_psAlloc */
     53/** Memory allocation. psAlloc sends file and line number to p_psAlloc. */
    5954#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
    60 /** psRealloc sends file and line number to p_psRealloc */
     55
     56/** Memory re-allocation.  psRealloc sends file and line number to p_psRealloc. */
    6157#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
    62 /** psFree sends file and line number to p_psFree */
     58
     59/** Free memory.  psFree sends file and line number to p_psFree. */
    6360#define psFree(size) p_psFree(size, __FILE__, __LINE__)
    6461
    65 /*
    66  * Ensure that any program using malloc/realloc/free will fail to compile
    67  */
     62/** prevent the use of 'malloc'. malloc is re-defined to throw an error in the C preprocessor */
    6863#define malloc(S) for
     64
     65/** prevent the use of 'realloc'. realloc is re-defined to throw an error in the C preprocessor */
    6966#define realloc(P,S) for
     67
     68/** prevent the use of 'free'. free is re-defined to throw an error in the C preprocessor */
    7069#define free(P) for
    7170
     
    112111long psMemSetAllocateID(long id);       //!< set p_psMemAllocateID to id
    113112long psMemSetFreeID(long id);           //!< set p_psMemFreeID to id
     113
    114114#endif
Note: See TracChangeset for help on using the changeset viewer.