Added memory management.
[yaz-moved-to-github.git] / odr / odr_util.c
1 #include <odr.h>
2 #include <stdlib.h>
3
4 char *odr_indent(ODR o)
5 {
6     static char buf[512];
7
8     memset(buf, ' ', 512);
9     buf[o->indent * 4] = 0;
10     return buf;
11 }
12
13 int odp_more_chunks(ODR o, unsigned char *base, int len)
14 {
15     if (!len)
16         return 0;
17     if (len < 0) /* indefinite length */
18     {
19         if (*o->bp == 0 && *(o->bp + 1) == 0)
20         {
21             o->bp += 2;
22             o->left -= 2;
23             return 0;
24         }
25         else
26             return 1;
27     }
28     else
29         return o->bp - base < len;
30 }