X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fodr_mem.c;h=42f8d873c89a4527e8a3c41c2b39bd9fac811029;hp=e35de260166e98e010d5bcc8892f92c09595bb39;hb=3f282496986cbae7fd4bd7f95d44bf47a2cc6874;hpb=fb6d99a0c7e07d9cc4a315c447deaf6564a85505 diff --git a/src/odr_mem.c b/src/odr_mem.c index e35de26..42f8d87 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: odr_mem.c,v 1.5 2005-06-25 15:46:04 adam Exp $ + * $Id: odr_mem.c,v 1.7 2006-02-19 18:33:09 adam Exp $ */ /** * \file odr_mem.c @@ -60,6 +60,16 @@ int odr_total(ODR o) return o->mem ? nmem_total(o->mem) : 0; } +Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf, int sz) +{ + Odr_oct *p = (Odr_oct *) odr_malloc(o, sizeof(Odr_oct)); + p->buf = odr_malloc(o, sz); + memcpy(p->buf, buf, sz); + p->size = sz; + p->len = sz; + return p; +} + /* ---------- memory management for data encoding ----------*/ @@ -81,9 +91,6 @@ int odr_grow_block(ODR b, int min_bytes) else if (!b->size && !(b->buf = (unsigned char *) xmalloc(b->size = togrow))) abort(); -#ifdef ODR_DEBUG - fprintf(stderr, "New size for encode_buffer: %d\n", b->size); -#endif return 0; }