aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-12 02:44:39 +0000
committerDavid Robillard <d@drobilla.net>2011-12-12 02:44:39 +0000
commita230bac3a01365911acb89312a21ce186be6efe1 (patch)
tree1f3bb847a4e425c276a4d7d07eec5714df61b244 /src
parentcd4ad24910a7e8ed48e7bed92c1b6892b082a7ef (diff)
downloadserd-a230bac3a01365911acb89312a21ce186be6efe1.tar.gz
serd-a230bac3a01365911acb89312a21ce186be6efe1.tar.bz2
serd-a230bac3a01365911acb89312a21ce186be6efe1.zip
Remove branch for EOF detection in eat_byte.
git-svn-id: http://svn.drobilla.net/serd/trunk@251 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r--src/reader.c13
-rw-r--r--src/serdi.c2
2 files changed, 5 insertions, 10 deletions
diff --git a/src/reader.c b/src/reader.c
index c1c2a1bd..4424c61c 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -158,6 +158,7 @@ eat_byte(SerdReader* reader, const uint8_t byte)
const uint8_t c = peek_byte(reader);
++reader->read_head;
switch (c) {
+ case '\0': reader->eof = true; break;
case '\n': ++reader->cur.line; reader->cur.col = 0; break;
default: ++reader->cur.col;
}
@@ -169,9 +170,6 @@ eat_byte(SerdReader* reader, const uint8_t byte)
TRY_RET(page(reader));
assert(reader->read_head < SERD_PAGE_SIZE);
}
- if (reader->read_buf[reader->read_head] == '\0') {
- reader->eof = true;
- }
return c;
}
@@ -1204,9 +1202,6 @@ read_objectList(SerdReader* reader, ReadContext ctx, bool blank)
static bool
read_predicateObjectList(SerdReader* reader, ReadContext ctx, bool blank)
{
- if (reader->eof) {
- return false;
- }
Ref predicate = 0;
TRY_RET(read_verb(reader, &predicate));
TRY_THROW(read_ws_plus(reader));
@@ -1394,10 +1389,10 @@ read_statement(SerdReader* reader)
SerdStatementFlags flags = 0;
ReadContext ctx = { 0, 0, 0, &flags };
read_ws_star(reader);
- if (reader->eof) {
- return true;
- }
switch (peek_byte(reader)) {
+ case '\0':
+ reader->eof = true;
+ return true;
case '@':
TRY_RET(read_directive(reader));
break;
diff --git a/src/serdi.c b/src/serdi.c
index 6020a271..c5183008 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -155,7 +155,7 @@ main(int argc, char** argv)
if (from_file) {
in_name = in_name ? in_name : input;
if (!in_fd) {
- input = serd_uri_to_path(input);
+ input = serd_uri_to_path(in_name);
if (!(in_fd = serd_fopen((const char*)input, "r"))) {
return 1;
}