From: Adam Dickmeiss Date: Thu, 30 Sep 2004 11:06:41 +0000 (+0000) Subject: Create NMEM automatically for odr_{str,int}dup. X-Git-Tag: YAZ.2.0.26~13 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d4bf9f0fc12586d2c0c38b77b6d4c865158a62ba;p=yaz-moved-to-github.git Create NMEM automatically for odr_{str,int}dup. --- diff --git a/src/odr_mem.c b/src/odr_mem.c index a18b372..db9deca 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1995-2003, Index Data + * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: odr_mem.c,v 1.1 2003-10-27 12:21:33 adam Exp $ + * $Id: odr_mem.c,v 1.2 2004-09-30 11:06:41 adam Exp $ */ #if HAVE_CONFIG_H #include @@ -34,6 +34,8 @@ void *odr_malloc(ODR o, int size) char *odr_strdup(ODR o, const char *str) { + if (o && !o->mem) + o->mem = nmem_create(); return nmem_strdup(o->mem, str); } @@ -44,6 +46,8 @@ char *odr_strdupn(ODR o, const char *str, size_t n) int *odr_intdup(ODR o, int v) { + if (o && !o->mem) + o->mem = nmem_create(); return nmem_intdup(o->mem, v); }