X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fnmemsdup.c;h=f27f8145f8ab6ec4a88d97651c20c3926a55f251;hb=80fee38926477efd73c739731c5670d59c5d1bf7;hp=4ba527dfa493b67f26c5d76487f7af0d8c06b46c;hpb=c168cffc46e3b2b66e66e48f94f8e87b6566702b;p=yaz-moved-to-github.git diff --git a/src/nmemsdup.c b/src/nmemsdup.c index 4ba527d..f27f814 100644 --- a/src/nmemsdup.c +++ b/src/nmemsdup.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2006, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. - * - * $Id: nmemsdup.c,v 1.9 2006-08-11 12:50:23 adam Exp $ */ /** @@ -15,10 +13,7 @@ #endif #include -#include -#if YAZ_HAVE_XML2 -#include -#endif +#include char *nmem_strdup (NMEM mem, const char *src) { @@ -43,9 +38,16 @@ char *nmem_strdupn (NMEM mem, const char *src, size_t n) return dst; } -int *nmem_intdup(NMEM mem, int v) +nmem_int_t *nmem_intdup(NMEM mem, nmem_int_t v) +{ + nmem_int_t *dst = (nmem_int_t*) nmem_malloc (mem, sizeof(*dst)); + *dst = v; + return dst; +} + +nmem_bool_t *nmem_booldup(NMEM mem, nmem_bool_t v) { - int *dst = (int*) nmem_malloc (mem, sizeof(int)); + nmem_bool_t *dst = (nmem_bool_t*) nmem_malloc (mem, sizeof(*dst)); *dst = v; return dst; } @@ -73,7 +75,7 @@ void nmem_strsplit(NMEM nmem, const char *delim, const char *dstr, else { size_t i = 0; - *darray = nmem_malloc(nmem, *num * sizeof(**darray)); + *darray = (char **) nmem_malloc(nmem, *num * sizeof(**darray)); for (cp = dstr; *cp; ) { const char *cp0; @@ -111,6 +113,7 @@ char *nmem_text_node_cdata(const xmlNode *ptr_cdata, NMEM nmem) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab