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

 

mem_new_trans_

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

Synopsis

Allocates a transaction block. Use the mem new trans() macro to call this function. Use mem_commit or mem rollback() to delete the transaction. Returns a pointer to the allocated transaction block, or NULL if there was not enough memory available. The supplied source file name is assumed to be in a static area.

Source Code - (sflmem.c)

{
    MEMTRN
       *trn;                            /*  Allocated transaction block      */

    /*  Allocate block                                                       */
    trn = malloc (MEMTRN_SIZE);
    if (trn == NULL)
        return (NULL);

#   if (defined (MEM_TRACE))
    if (filename)
        trace ("%s (%d): new transaction", filename, lineno);
#   endif

    trn-> file = (char *) filename;     /*  Who allocated it                 */
    trn-> line = lineno;                /*    and where                      */
    list_reset (&trn-> memhdr);         /*  No memory blocks yet             */

    list_reset (trn);                   /*  Only 1 item in list              */
    list_relink_before (trn, &tr_list);  /*  Add to list of transactions      */
    return (trn);                       /*   and return address              */
}

| << | < | > | >> iMatix Copyright © 1996-98 iMatix