2 * Copyright (c) 1995-1998, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.14 1998-10-13 15:58:36 adam
8 * Minor fix in odr_getoidbystr_nmem.
10 * Revision 1.13 1998/02/11 11:53:34 adam
11 * Changed code so that it compiles as C++.
13 * Revision 1.12 1997/10/31 12:20:08 adam
14 * Improved memory debugging for xmalloc/nmem.c. References to NMEM
15 * instead of ODR in n ESPEC-1 handling in source d1_espec.c.
16 * Bug fix: missing fclose in data1_read_espec1.
26 char *odr_indent(ODR o)
31 memset(buf, ' ', 512);
34 buf[o->indent * 4] = 0;
38 int odp_more_chunks(ODR o, unsigned char *base, int len)
42 if (len < 0) /* indefinite length */
44 if (*o->bp == 0 && *(o->bp + 1) == 0)
54 return o->bp - base < len;
57 Odr_oid *odr_oiddup_nmem(NMEM nmem, Odr_oid *o)
63 if (!(r = (int *)nmem_malloc(nmem, (oid_oidlen(o) + 1) * sizeof(int))))
69 Odr_oid *odr_oiddup(ODR odr, Odr_oid *o)
71 return odr_oiddup_nmem (odr->mem, o);
74 Odr_oid *odr_getoidbystr_nmem(NMEM nmem, char *str)
82 while ((p = strchr(p, '.')))
84 ret = (int *)nmem_malloc(nmem, sizeof(*ret)*(num + 1));
88 while ((p = strchr(p, '.')) && *++p);
93 Odr_oid *odr_getoidbystr(ODR o, char *str)
95 return odr_getoidbystr_nmem (o->mem, str);