Changeset: efdfd812c89d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=efdfd812c89d
Modified Files:
        common/stream/stream.c
Branch: mlogger
Log Message:

Removed Tracer -> stream.c


diffs (truncated from 380 to 300 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -53,7 +53,6 @@
 #include "stream.h"
 #include "stream_socket.h"
 #include "matomic.h"
-#include "gdk_tracer.h"
 
 #include <string.h>
 #include <stddef.h>
@@ -364,7 +363,7 @@ mnstr_read(stream *restrict s, void *res
        if (s == NULL || buf == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Read: %s %zu %zu\n",
+       fprintf(stderr, "read %s %zu %zu\n",
                s->name ? s->name : "<unnamed>", elmsize, cnt);
 #endif
        assert(s->readonly);
@@ -384,7 +383,7 @@ mnstr_readline(stream *restrict s, void 
        if (s == NULL || buf == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Readline: %s %zu\n",
+       fprintf(stderr, "readline %s %zu\n",
                s->name ? s->name : "<unnamed>", maxcnt);
 #endif
        assert(s->readonly);
@@ -442,7 +441,7 @@ mnstr_write(stream *restrict s, const vo
        if (s == NULL || buf == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Write: %s %zu %zu\n",
+       fprintf(stderr, "write %s %zu %zu\n",
                s->name ? s->name : "<unnamed>", elmsize, cnt);
 #endif
        assert(!s->readonly);
@@ -467,7 +466,7 @@ mnstr_close(stream *s)
 {
        if (s) {
 #ifdef STREAM_DEBUG
-               Trace(M_DEBUG, "Close: %s\n", s->name ? s->name : "<unnamed>");
+               fprintf(stderr, "close %s\n", s->name ? s->name : "<unnamed>");
 #endif
                s->close(s);
        }
@@ -478,7 +477,7 @@ mnstr_destroy(stream *s)
 {
        if (s) {
 #ifdef STREAM_DEBUG
-               Trace(M_DEBUG, "Destroy: %s\n",
+               fprintf(stderr, "destroy %s\n",
                        s->name ? s->name : "<unnamed>");
 #endif
                s->destroy(s);
@@ -500,7 +499,7 @@ mnstr_flush(stream *s)
        if (s == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Flush: %s\n", s->name ? s->name : "<unnamed>");
+       fprintf(stderr, "flush %s\n", s->name ? s->name : "<unnamed>");
 #endif
        assert(!s->readonly);
        if (s->errnr)
@@ -517,7 +516,7 @@ mnstr_fsync(stream *s)
        if (s == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter fsync: %s (%d)\n",
+       fprintf(stderr, "fsync %s (%d)\n",
                s->name ? s->name : "<unnamed>", s->errnr);
 #endif
        assert(!s->readonly);
@@ -534,7 +533,7 @@ mnstr_fgetpos(stream *restrict s, fpos_t
        if (s == NULL || p == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter fgetpos: %s\n", s->name ? s->name : "<unnamed>");
+       fprintf(stderr, "fgetpos %s\n", s->name ? s->name : "<unnamed>");
 #endif
        if (s->errnr)
                return -1;
@@ -549,7 +548,7 @@ mnstr_fsetpos(stream *restrict s, fpos_t
        if (s == NULL)
                return -1;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter fsetpos: %s\n", s->name ? s->name : "<unnamed>");
+       fprintf(stderr, "fsetpos %s\n", s->name ? s->name : "<unnamed>");
 #endif
        if (s->errnr)
                return -1;
@@ -620,7 +619,7 @@ mnstr_set_bigendian(stream *s, bool bige
        if (s == NULL)
                return;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Set stream to big-endian byte order: %s %s\n",
+       fprintf(stderr, "mnstr_set_bigendian %s %s\n",
                s->name ? s->name : "<unnamed>",
                swapbytes ? "true" : "false");
 #endif
@@ -710,7 +709,7 @@ create_stream(const char *name)
                return NULL;
        }
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter create_stream: %s -> %p\n",
+       fprintf(stderr, "create_stream %s -> %p\n",
                name ? name : "<unnamed>", s);
 #endif
        return s;
@@ -2039,7 +2038,7 @@ open_rstream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter open_rstream: %s\n", filename);
+       fprintf(stderr, "open_rstream %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2067,7 +2066,7 @@ open_wstream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter open_wstream: %s\n", filename);
+       fprintf(stderr, "open_wstream %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2096,7 +2095,7 @@ open_rastream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter open_rastream: %s\n", filename);
+       fprintf(stderr, "open_rastream %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2124,7 +2123,7 @@ open_wastream(const char *filename)
        if (filename == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter open_wastream: %s\n", filename);
+       fprintf(stderr, "open_wastream %s\n", filename);
 #endif
        ext = get_extension(filename);
 
@@ -2737,7 +2736,7 @@ socket_rstream(SOCKET sock, const char *
        stream *s = NULL;
 
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter socket_rstream: %zd %s\n", (ssize_t) sock, name);
+       fprintf(stderr, "socket_rstream %zd %s\n", (ssize_t) sock, name);
 #endif
        if ((s = socket_open(sock, name)) != NULL)
                s->binary = true;
@@ -2750,7 +2749,7 @@ socket_wstream(SOCKET sock, const char *
        stream *s;
 
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter socket_wstream: %zd %s\n", (ssize_t) sock, name);
+       fprintf(stderr, "socket_wstream %zd %s\n", (ssize_t) sock, name);
 #endif
        if ((s = socket_open(sock, name)) == NULL)
                return NULL;
@@ -3094,7 +3093,7 @@ file_rstream(FILE *restrict fp, const ch
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter file_rstream: %s\n", name);
+       fprintf(stderr, "file_rstream %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3111,7 +3110,7 @@ file_wstream(FILE *restrict fp, const ch
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter file_wstream: %s\n", name);
+       fprintf(stderr, "file_wstream %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3132,7 +3131,7 @@ file_rastream(FILE *restrict fp, const c
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter file_rastream: %s\n", name);
+       fprintf(stderr, "file_rastream %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3203,7 +3202,8 @@ file_wastream(FILE *restrict fp, const c
        if (fp == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter file_wastream: %s\n", name);
+
+       fprintf(stderr, "file_wastream %s\n", name);
 #endif
        if ((s = file_stream(name)) == NULL)
                return NULL;
@@ -3575,7 +3575,7 @@ iconv_rstream(stream *restrict ss, const
        if (ss == NULL || charset == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter iconv_rstream: %s %s\n", charset, name);
+       fprintf(stderr, "iconv_rstream %s %s\n", charset, name);
 #endif
        if (ss->isutf8)
                return ss;
@@ -3601,7 +3601,7 @@ iconv_wstream(stream *restrict ss, const
        if (ss == NULL || charset == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter iconv_wstream: %s %s\n", charset, name);
+       fprintf(stderr, "iconv_wstream %s %s\n", charset, name);
 #endif
        if (ss->isutf8)
                return ss;
@@ -3792,7 +3792,7 @@ buffer_rastream(buffer *restrict b, cons
        if (b == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter buffer_rastream: %s\n", name);
+       fprintf(stderr, "buffer_rastream %s\n", name);
 #endif
        if ((s = create_stream(name)) == NULL)
                return NULL;
@@ -3813,7 +3813,7 @@ buffer_wastream(buffer *restrict b, cons
        if (b == NULL || name == NULL)
                return NULL;
 #ifdef STREAM_DEBUG
-       Trace(M_DEBUG, "Enter buffer_wastream: %s\n", name);
+       fprintf(stderr, "buffer_wastream %s\n", name);
 #endif
        if ((s = create_stream(name)) == NULL)
                return NULL;
@@ -3896,13 +3896,13 @@ bs_write(stream *restrict ss, const void
                        {
                                unsigned i;
 
-                               Trace(M_DEBUG, "Write: %s %u \"  HERE  \"\n", 
ss->name, s->nr);
-
+                               fprintf(stderr, "W %s %u \"", ss->name, s->nr);
                                for (i = 0; i < s->nr; i++)
                                        if (' ' <= s->buf[i] && s->buf[i] < 127)
                                                putc(s->buf[i], stderr);
                                        else
                                                fprintf(stderr, "\\%03o", 
s->buf[i]);
+                               fprintf(stderr, "\"\n");
                        }
 #endif
                        /* since the block is at max BLOCK (8K) - 2 size we can
@@ -3949,13 +3949,14 @@ bs_flush(stream *ss)
                if (s->nr > 0) {
                        unsigned i;
 
-                       Trace(M_DEBUG, "Flush: %s %u \"  HERE  \"\n", ss->name, 
s->nr);
-
+                       fprintf(stderr, "W %s %u \"", ss->name, s->nr);
                        for (i = 0; i < s->nr; i++)
                                if (' ' <= s->buf[i] && s->buf[i] < 127)
                                        putc(s->buf[i], stderr);
                                else
                                        fprintf(stderr, "\\%03o", s->buf[i]);
+                       fprintf(stderr, "\"\n");
+                       fprintf(stderr, "W %s 0\n", ss->name);
                }
 #endif
                blksize = (uint16_t) (s->nr << 1);
@@ -4030,8 +4031,8 @@ bs_read(stream *restrict ss, void *restr
                        return -1;
                }
 #ifdef BSTREAM_DEBUG
-               Trace(M_DEBUG, "RC size: %u, final: %s\n", (uint16_t) blksize 
>> 1, (uint16_t) blksize & 1 ? "true" : "false");
-               Trace(M_DEBUG, "RC %s %u\n", ss->name, (uint16_t) blksize);
+               fprintf(stderr, "RC size: %u, final: %s\n", (uint16_t) blksize 
>> 1, (uint16_t) blksize & 1 ? "true" : "false");
+               fprintf(stderr, "RC %s %u\n", ss->name, (uint16_t) blksize);
 #endif
                s->itotal = (uint16_t) blksize >> 1;    /* amount readable */
                /* store whether this was the last block or not */
@@ -4057,13 +4058,14 @@ bs_read(stream *restrict ss, void *restr
                        {
                                ssize_t i;
 
-                               Trace(M_DEBUG, "Read: %s %zd \"  HERE  \"\n", 
ss->name, m, );
-
+                               fprintf(stderr, "RD %s %zd \"", ss->name, m);
                                for (i = 0; i < m; i++)
-                                       if (' ' <= ((char *) buf)[i] && ((char 
*) buf)[i] < 127)
+                                       if (' ' <= ((char *) buf)[i] &&
+-                                          ((char *) buf)[i] < 127)
                                                putc(((char *) buf)[i], stderr);
                                        else
                                                fprintf(stderr, "\\%03o", 
((char *) buf)[i]);
+                               fprintf(stderr, "\"\n");
                        }
 #endif
                        buf = (void *) ((char *) buf + m);
@@ -4095,8 +4097,9 @@ bs_read(stream *restrict ss, void *restr
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to