| iMatix home page | << | < | > | >> |
![]() Version 1.91 |
#include "sflmem.h" MEMTRN * mem_new_trans_( const char *filename, /* Name of source file making call */ word lineno /* Line number in calling source */ )
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.
{ 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 */ }
| << | < | > | >> |
![]() |