usr/kevin/code/develop/sim_gil_obj.c
int gil_create(int ncomp, int nreact, gil_t ** pgi) {

  gil_t * p;

  dbg_return_if(pgi == NULL, -1);
  dbg_return_if(ncomp < 1, -1);
  dbg_return_if(nreact < 0, -1);

  err_err_if((p = u_calloc(1, sizeof(gil_t))) == NULL);
  p->ncomponent = ncomp;
  p->nreaction = nreact;

  dbg_err_if(u_list_create(&p->components));
  dbg_err_if(u_list_create(&p->reactions));
  *pgi = p;

  return 0;

 err:
  if (p->reactions) u_list_free(p->reactions);
  if (p->components) u_list_free(p->components);
  u_free(p);

  return -1;
}
/*****************************************************************************
 *
 *  \brief Allocate and return a new Gillespie object
 *
 *  To create a Gillespie object via this function, there must be
 *  at least one component, but we allow no reactions.
 *
 *  \param ncomp    the number of components in the scheme
 *  \param nreact   the number of reactions in the scheme
 *
 *  \retval 0       a success
 *  \retval -1      a failure
 *
 *****************************************************************************/
\brief Allocate and return a new Gillespie object
To create a Gillespie object via this function, there must be
at least one component, but we allow no reactions.

\param ncomp    the number of components in the scheme
\param nreact   the number of reactions in the scheme

\retval 0       a success
\retval -1      a failure
\ brief Allocate and return a new Gillespie object To create a Gillespie object via this function there must be at least one component but we allow no reactions . \ param ncomp the number of components in the scheme \ param nreact the number of reactions in the scheme \ retval 0 a success \ retval - 1 a failure
int gil_create(int ncomp, int nreact, gil_t ** pgi) {
  gil_t * p;
  dbg_return_if(pgi == NULL, -1);
  dbg_return_if(ncomp < 1, -1);
  dbg_return_if(nreact < 0, -1);
  err_err_if((p = u_calloc(1, sizeof(gil_t))) == NULL);
  p->ncomponent = ncomp;
  p->nreaction = nreact;
  dbg_err_if(u_list_create(&p->components));
  dbg_err_if(u_list_create(&p->reactions));
  *pgi = p;
  return 0;
 err:
  if (p->reactions) u_list_free(p->reactions);
  if (p->components) u_list_free(p->components);
  u_free(p);
  return -1;
}
int gil_create ( int ncomp , int nreact , gil_t * * pgi ) { gil_t * p ; dbg_return_if ( pgi == NULL , -1 ) ; dbg_return_if ( ncomp < 1 , -1 ) ; dbg_return_if ( nreact < 0 , -1 ) ; err_err_if ( ( p = u_calloc ( 1 , sizeof ( gil_t ) ) ) == NULL ) ; p -> ncomponent = ncomp ; p -> nreaction = nreact ; dbg_err_if ( u_list_create ( & p -> components ) ) ; dbg_err_if ( u_list_create ( & p -> reactions ) ) ; * pgi = p ; return 0 ; err : if ( p -> reactions ) u_list_free ( p -> reactions ) ; if ( p -> components ) u_list_free ( p -> components ) ; u_free ( p ) ; return -1 ; }
\brief Allocate and return a new Gillespie object
  To create a Gillespie object via this function, there must be
  at least one component, but we allow no reactions.
\ brief Allocate and return a new Gillespie object To create a Gillespie object via this function there must be at least one component but we allow no reactions .