projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
[yaz-moved-to-github.git]
/
src
/
odr_mem.c
diff --git
a/src/odr_mem.c
b/src/odr_mem.c
index
d9e4025
..
c970f6b
100644
(file)
--- a/
src/odr_mem.c
+++ b/
src/odr_mem.c
@@
-1,8
+1,6
@@
-/*
- * Copyright (C) 1995-2007, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data
* See the file LICENSE for details.
* See the file LICENSE for details.
- *
- * $Id: odr_mem.c,v 1.9 2007-03-19 21:08:13 adam Exp $
*/
/**
* \file odr_mem.c
*/
/**
* \file odr_mem.c
@@
-25,24
+23,25
@@
NMEM odr_extract_mem(ODR o)
{
NMEM r = o->mem;
{
NMEM r = o->mem;
- o->mem = 0;
+ o->mem = nmem_create();
return r;
}
void *odr_malloc(ODR o, int size)
{
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)
{
}
char *odr_strdup(ODR o, const char *str)
{
- if (o && !o->mem)
- o->mem = nmem_create();
return nmem_strdup(o->mem, 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);
char *odr_strdupn(ODR o, const char *str, size_t n)
{
return nmem_strdupn(o->mem, str, n);
@@
-50,20
+49,18
@@
char *odr_strdupn(ODR o, const char *str, size_t n)
int *odr_intdup(ODR o, int v)
{
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 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)
{
Odr_oct *p = (Odr_oct *) odr_malloc(o, sizeof(Odr_oct));
}
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);
+ p->buf = (unsigned char *) odr_malloc(o, sz);
memcpy(p->buf, buf, sz);
p->size = sz;
p->len = sz;
memcpy(p->buf, buf, sz);
p->size = sz;
p->len = sz;