summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-08-18 17:30:53 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-08-18 17:30:53 +0000
commita5351f9e4144ab6abbfa83fa5b10eacb9865db69 (patch)
treedc7eb9e707e14bcc1b85ee2b20dad3a01181c9a4
parent966c0728f5179d87cdbadf13d13550b8d4dd4865 (diff)
downloadlibparserutils-a5351f9e4144ab6abbfa83fa5b10eacb9865db69.tar.gz
libparserutils-a5351f9e4144ab6abbfa83fa5b10eacb9865db69.tar.bz2
Yet more debug.
svn path=/trunk/libparserutils/; revision=5149
-rw-r--r--include/parserutils/input/inputstream.h20
1 files changed, 19 insertions, 1 deletions
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 <stdbool.h>
+#ifndef NDEBUG
+#include <stdio.h>
+#endif
#include <stdlib.h>
#include <inttypes.h>
@@ -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();