From a5351f9e4144ab6abbfa83fa5b10eacb9865db69 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 18 Aug 2008 17:30:53 +0000 Subject: Yet more debug. svn path=/trunk/libparserutils/; revision=5149 --- include/parserutils/input/inputstream.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'include/parserutils') diff --git a/include/parserutils/input/inputstream.h b/include/parserutils/input/inputstream.h index 7e811b4..3a24e84 100644 --- a/include/parserutils/input/inputstream.h +++ b/include/parserutils/input/inputstream.h @@ -9,6 +9,9 @@ #define parserutils_input_inputstream_h_ #include +#ifndef NDEBUG +#include +#endif #include #include @@ -86,6 +89,8 @@ static inline uintptr_t parserutils_inputstream_peek( return PARSERUTILS_INPUTSTREAM_OOD; #ifndef NDEBUG + fprintf(stdout, "Peek: len: %lu cur: %lu off: %lu\n", + stream->utf8->length, stream->cursor, offset); parserutils_buffer_randomise(stream->utf8); #endif @@ -109,10 +114,18 @@ static inline uintptr_t parserutils_inputstream_peek( if (stream->cursor + offset == stream->utf8->length || error == PARSERUTILS_NEEDDATA) { - return parserutils_inputstream_peek_slow(stream, + uintptr_t data = parserutils_inputstream_peek_slow(stream, offset, length); +#ifndef NDEBUG + fprintf(stdout, "clen: %lu\n", *length); +#endif + return data; } +#ifndef NDEBUG + fprintf(stdout, "clen: %lu\n", len); +#endif + *length = len; return (uintptr_t) (stream->utf8->data + stream->cursor + offset); @@ -130,6 +143,11 @@ static inline void parserutils_inputstream_advance( if (stream == NULL) return; +#ifndef NDEBUG + fprintf(stdout, "Advance: len: %lu cur: %lu bytes: %lu\n", + stream->utf8->length, stream->cursor, bytes); +#endif + if (bytes > stream->utf8->length - stream->cursor) abort(); -- cgit v1.2.3