IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 369


Ignore:
Timestamp:
Mar 31, 2004, 11:55:47 PM (22 years ago)
Author:
eugene
Message:

changed psMemBlock to new endposts, adjusted CB names

File:
1 edited

Legend:

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

    r344 r369  
    1616 */
    1717typedef struct {
    18     const void *magic0;                 ///< initialised to p_psMEMMAGIC
     18    const void *startblock;             ///< initialised to p_psMEMMAGIC
    1919    const unsigned long id;             ///< a unique ID for this allocation
    2020    const char *file;                   ///< set from __FILE__ in e.g. p_psAlloc
    2121    const int lineno;                   ///< set from __LINE__ in e.g. p_psAlloc
    2222    int refCounter;                     ///< how many times pointer is referenced
    23     const void *magic;                  ///< initialised to p_psMEMMAGIC
     23    const void **endpost;               ///< initialised to p_psMEMMAGIC
     24    const void *endblock;               ///< initialised to p_psMEMMAGIC
    2425} psMemBlock;
    2526
    2627/// prototype of a basic callback used by memory functions
    27 typedef int (*psMemCallback)(const psMemBlock *ptr);
     28typedef long (*psMemAllocateCB)(const psMemBlock *ptr);
     29
     30/// prototype of memory free callback used by memory functions
     31typedef long (*psMemFreeCB)(const psMemBlock *ptr);
    2832
    2933/// prototype of a callback used in error conditions
    30 typedef void (*psMemProblemCallback)(const psMemBlock *ptr, const char *file, int lineno);
     34typedef void (*psMemProblemCB)(const psMemBlock *ptr, const char *file, int lineno);
    3135
    3236/// prototype of a callback used when memory runs out
    33 typedef void *(*psMemExhaustedCallback)(size_t size);
     37typedef void *(*psMemExhaustedCB)(size_t size);
    3438
    3539/** Functions **************************************************************/
     
    4145void *p_psAlloc(size_t size,            ///< Size required
    4246                const char *file,       ///< File of call
    43                 int lineno              ///< Line number of call
    44                 );
     47                int lineno)             ///< Line number of call
     48;
    4549
    4650/// Memory re-allocation.  Underlying private function called by macro psRealloc.
     
    4852                  size_t size,          ///< Size required
    4953                  const char *file,     ///< File of call
    50                   int lineno            ///< Line number of call
    51                   );
     54                  int lineno)           ///< Line number of call
     55;
    5256
    5357/// Free memory.  Underlying private function called by macro psFree.
    5458void p_psFree(void *ptr,                ///< Pointer to free
    5559              const char *file,         ///< File of call
    56               int lineno                ///< Line number of call
    57               );
     60              int lineno)               ///< Line number of call
     61;
    5862
    5963/// Check for memory leaks
    6064int psMemCheckLeaks(int id0,            ///< don't list blocks with id < id0
    6165                    psMemBlock ***arr,  ///< pointer to array of pointers to leaked blocks, or NULL
    62                     FILE *fd            ///< print list of leaks to fd (or NULL)
    63                     );
     66                    FILE *fd)           ///< print list of leaks to fd (or NULL)
     67;
    6468
    6569/// Check for memory corruption
    66 int psMemCheckCorruption(int abort_on_error ///< Abort on detecting corruption?
    67                          );
     70int psMemCheckCorruption(int abort_on_error) ///< Abort on detecting corruption?
     71;
    6872
    6973/// Return reference counter
    70 int psMemGetRefCounter(void *vptr       ///< Pointer to get refCounter for
    71                        );
     74int psMemGetRefCounter(void *vptr)      ///< Pointer to get refCounter for
     75;
    7276
    7377/// Increment reference counter and return the pointer
    74 void *psMemIncrRefCounter(void *vptr    ///< Pointer to increment refCounter, and return
    75                           );
     78void *psMemIncrRefCounter(void *vptr)   ///< Pointer to increment refCounter, and return
     79;
    7680
    7781/// Decrement reference counter and return the pointer
    78 void *psMemDecrRefCounter(void *vptr    ///< Pointer to decrement refCounter, and return
    79                           );
     82void *psMemDecrRefCounter(void *vptr)   ///< Pointer to decrement refCounter, and return
     83;
    8084
    8185/// Set callback for problems
    82 psMemProblemCallback psMemProblemSetCB(psMemProblemCallback func ///< Function to run
    83                                        );
     86psMemProblemCB psMemProblemCBSet(psMemProblemCB func) ///< Function to run
     87;
    8488
    8589/// Set callback for out-of-memory
    86 psMemExhaustedCallback psMemExhaustedSetCB(psMemExhaustedCallback func ///< Function to run
    87                                            );
     90psMemExhaustedCB psMemExhaustedCBSet(psMemExhaustedCB func) ///< Function to run
     91;
    8892
    8993/// Set call back for when a particular memory block is allocated
    90 psMemCallback psMemAllocateSetCB(psMemCallback func ///< Function to run
    91                                  );
     94psMemCB psMemAllocateCBSet(psMemAllocateCB func) ///< Function to run
     95;
    9296
    9397/// Set call back for when a particular memory block is freed
    94 psMemCallback psMemFreeSetCB(psMemCallback func
    95                              );
     98psMemCB psMemFreeCBSet(psMemFreeCB func) ///< Function to run
     99;
    96100
    97101/// get next memory ID
    98 int psMemGetId(void);
     102int psMemGetId(void)
     103;
    99104
    100105/// set p_psMemAllocateID to id
    101 long psMemSetAllocateID(long id         ///< ID to set
    102                         );
     106long psMemAllocateIDSet(long id)        ///< ID to set
     107;
    103108
    104109/// set p_psMemFreeID to id
    105 long psMemSetFreeID(long id             ///< ID to set
    106                     );
     110long psMemFreeIDSet(long id)            ///< ID to set
     111;
    107112
    108113/* \} */ // End of SystemGroup Functions
Note: See TracChangeset for help on using the changeset viewer.