From 116bfb8f4109efbe39bdfe98b0e17e15e8e50c4a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 11 Sep 2007 08:35:42 +0000 Subject: [PATCH] Added odr_strdup_null which calls nmem_strdup_null. This function accepts a NULL ptr as source in which the result is a NULL ptr too. --- include/yaz/odr.h | 3 ++- src/odr_mem.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/yaz/odr.h b/include/yaz/odr.h index b84ebcd..d9d77df 100644 --- a/include/yaz/odr.h +++ b/include/yaz/odr.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: odr.h,v 1.28 2007-05-08 08:22:35 adam Exp $ */ +/* $Id: odr.h,v 1.29 2007-09-11 08:35:42 adam Exp $ */ /** * \file odr.h @@ -184,6 +184,7 @@ YAZ_EXPORT char *odr_getbuf(ODR o, int *len, int *size); YAZ_EXPORT void *odr_malloc(ODR o, int size); YAZ_EXPORT char *odr_strdup(ODR o, const char *str); YAZ_EXPORT char *odr_strdupn(ODR o, const char *str, size_t n); +YAZ_EXPORT char *odr_strdup_null(ODR o, const char *str); YAZ_EXPORT int *odr_intdup(ODR o, int v); YAZ_EXPORT Odr_oct *odr_create_Odr_oct(ODR o, const unsigned char *buf, int sz); diff --git a/src/odr_mem.c b/src/odr_mem.c index 6a2ef68..314361e 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: odr_mem.c,v 1.11 2007-05-06 20:12:20 adam Exp $ + * $Id: odr_mem.c,v 1.12 2007-09-11 08:35:42 adam Exp $ */ /** * \file odr_mem.c @@ -39,6 +39,11 @@ char *odr_strdup(ODR o, const char *str) return nmem_strdup(o->mem, str); } +char *odr_strdup_null(ODR o, const char *str) +{ + return nmem_strdup_null(o->mem, str); +} + char *odr_strdupn(ODR o, const char *str, size_t n) { return nmem_strdupn(o->mem, str, n); -- 1.7.10.4