Add odr_setprint_noclose
[yaz-moved-to-github.git] / src / odr.c
index 25fafb2..9cbac0d 100644 (file)
--- a/src/odr.c
+++ b/src/odr.c
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
  * See the file LICENSE for details.
  */
 
@@ -135,15 +135,6 @@ void odr_FILE_write(ODR o, void *handle, int type,
                     const char *buf, int len)
 {
     int i;
-#if 0
-    if (type  == ODR_OCTETSTRING)
-    {
-        const char **stack_names = odr_get_element_path(o);
-        for (i = 0; stack_names[i]; i++)
-            fprintf((FILE*) handle, "[%s]", stack_names[i]);
-        fputs("\n", (FILE*) handle);
-    }
-#endif
     for (i = 0; i < len; i++)
     {
         unsigned c = ((const unsigned char *) buf)[i];
@@ -175,6 +166,10 @@ void odr_setprint(ODR o, FILE *file)
     odr_set_stream(o, file, odr_FILE_write, odr_FILE_close);
 }
 
+void odr_setprint_noclose(ODR o, FILE *file)
+{
+    odr_set_stream(o, file, odr_FILE_write, 0);
+}
 
 void odr_set_stream(ODR o, void *handle,
                     void (*stream_write)(ODR o,
@@ -222,7 +217,7 @@ ODR odr_createmem(int direction)
     o->op->enable_bias = 1;
     o->op->odr_ber_tag.lclass = -1;
     o->op->iconv_handle = 0;
-    odr_setprint(o, stderr);
+    odr_setprint_noclose(o, stderr);
     odr_reset(o);
     yaz_log(log_level, "odr_createmem dir=%d o=%p", direction, o);
     return o;