* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: odr_mem.c,v 1.8 2007-01-03 08:42:15 adam Exp $
+ * $Id: odr_mem.c,v 1.10 2007-04-12 13:52:57 adam Exp $
*/
/**
* \file odr_mem.c
{
NMEM r = o->mem;
- o->mem = 0;
+ o->mem = nmem_create();
return r;
}
void *odr_malloc(ODR o, int size)
{
- if (o && !o->mem)
- o->mem = nmem_create();
- return nmem_malloc(o ? o->mem : 0, size);
+ return nmem_malloc(o->mem, size);
}
char *odr_strdup(ODR o, const char *str)
{
- if (o && !o->mem)
- o->mem = nmem_create();
return nmem_strdup(o->mem, str);
}
int *odr_intdup(ODR o, int v)
{
- if (o && !o->mem)
- o->mem = nmem_create();
return nmem_intdup(o->mem, v);
}
int odr_total(ODR o)
{
- return o->mem ? nmem_total(o->mem) : 0;
+ return nmem_total(o->mem);
}
Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf, int sz)
{
int togrow;
- if (!b->can_grow)
+ if (!b->op->can_grow)
return -1;
if (!b->size)
togrow = 1024;