| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

mem_rollback_

#include "sflmem.h"
void
mem_rollback_ (
    MEMTRN *trn,
    const char *filename,               /*  Name of source file making call  */
    size_t lineno                       /*  Line number in calling source    */
)

Synopsis

Rolls back allocations for a particular transaction. This frees up all blocks allocated by calls to mem_alloc, mem_realloc and mem_strdup since the last call to mem_commit. Note that for blocks allocated with mem_realloc, this is not really a rollback but a free. The mem rollback() function must be used with some care... if you forget to do a mem commit(), a later mem rollback() will do damage to your memory space. The general rule is to start your processing with mem commit(), then do work, and call mem rollback() when there is an error. Finally, call mem commit() at the end.

Source Code - (sflmem.c)

{
#   if (defined (MEM_TRACE))
    trace ("%s (%ld): rollback transaction",
           filename? filename: "-", (long) lineno);
#   endif

    mem_free_list ((MEMHDR *) &trn-> memhdr);
    mem_del_trans (trn);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation