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
Added Danmarc character set decoder (bug #2345).
[yaz-moved-to-github.git]
/
src
/
odr_mem.c
diff --git
a/src/odr_mem.c
b/src/odr_mem.c
index
c994c23
..
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.8 2007-01-03 08:42:15 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;
@@
-77,7
+74,7
@@
int odr_grow_block(ODR b, int min_bytes)
{
int togrow;
{
int togrow;
- if (!b->can_grow)
+ if (!b->op->can_grow)
return -1;
if (!b->size)
togrow = 1024;
return -1;
if (!b->size)
togrow = 1024;