Previous: , Up: handlers standard   [Contents][Index]


5.2.3 Guarded realloc() with the standard allocator

Usage example:

cce_location_t        L[1];
ccmem_clean_handler_t P_H[1];

if (cce_location(L)) {
  cce_run_catch_handlers_raise(L, upper_L);
} else {
  void *      P = ccmem_std_malloc_guarded(L, P_H, 4096);

  memset(P, 0, 4096);
  {
    void *    Q = ccmem_std_realloc_guarded(L, P_H, P, 2 * 4096);

    memset(Q, 0, 2 * 4096);
  }
  cce_run_body_handlers(L);
}
Function: void * ccmem_std_realloc_guarded_clean (cce_destination_t L, ccmem_clean_handler_t * P_H, void * P, size_t newsize)

Wrapper for ccmem_realloc_guarded_clean() that registers the allocated memory to be released by the handler referenced by P_H, using the standard allocator. Such handler must be the same one used in a previous call to ccmem_std_malloc_guarded_clean(), ccmem_std_calloc_guarded_clean() or ccmem_std_realloc_guarded_clean().

Function: void * ccmem_std_realloc_guarded_error (cce_destination_t L, ccmem_error_handler_t * P_H, void * P, size_t newsize)

Wrapper for ccmem_realloc_guarded_error() that registers the allocated memory to be released by the handler referenced by P_H, using the standard allocator. Such handler must be the same one used in a previous call to ccmem_std_malloc_guarded_clean() or ccmem_std_calloc_guarded_clean() or ccmem_std_realloc_guarded_clean().

Preprocessor Macro: void * ccmem_std_realloc_guarded (cce_destination_t L, P_H, void * P, size_t newsize)

If the argument P_H is a pointer of type:

ccmem_clean_handler_t

The macro use expands into a call to ccmem_std_realloc_guarded_clean().

ccmem_error_handler_t

The macro use expands into a call to ccmem_std_realloc_guarded_error().


Previous: , Up: handlers standard   [Contents][Index]

This document describes version 0.2.2-devel.3 of CCMemory.