Smallish changes.
[yaz-moved-to-github.git] / odr / odr.c
index bfa8334..2691c65 100644 (file)
--- a/odr/odr.c
+++ b/odr/odr.c
@@ -4,7 +4,13 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: odr.c,v $
- * Revision 1.7  1995-03-10 11:44:41  quinn
+ * Revision 1.9  1995-04-10 10:23:11  quinn
+ * Smallish changes.
+ *
+ * Revision 1.8  1995/03/17  10:17:43  quinn
+ * Added memory management.
+ *
+ * Revision 1.7  1995/03/10  11:44:41  quinn
  * Fixed serious stack-bug in odr_cons_begin
  *
  * Revision 1.6  1995/03/08  12:12:15  quinn
@@ -69,9 +75,10 @@ ODR odr_createmem(int direction)
     if (!(r = malloc(sizeof(*r))))
        return 0;
     r->direction = direction;
-    r->print = stdout;
+    r->print = stderr;
     r->buf = 0;
     r->buflen = 0;
+    r->mem = 0;
     odr_reset(r);
     return r;
 }
@@ -85,10 +92,15 @@ void odr_reset(ODR o)
     o->t_tag = -1;
     o->indent = 0;
     o->stackp = -1;
+    odr_release_mem(o->mem);
+    o->mem = 0;
 }
     
 void odr_destroy(ODR o)
 {
+    odr_release_mem(o->mem);
+    if (o->print != stderr)
+       fclose(o->print);
     free(o);
 }