|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflmem.h"
MEMTRN *
mem_new_trans_(
const char *filename, /* Name of source file making call */
size_t lineno /* Line number in calling source */
)
Allocates a transaction block. Use the mem new trans() macro to call this function. Use mem_commit to save 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.
{
MEMTRN
*trn; /* Allocated transaction block */
/* Allocate block */
trn = malloc (MEMTRN_SIZE);
if (trn == NULL)
return (NULL);
# if (defined (MEM_TRACE))
trace ("%s (%ld): new transaction",
filename? filename: "-", (long) 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 */
}
| | << | < | > | >> |
|