From a70c8c2b121dc00973f8184cd982cbba00b1529f Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sun, 9 Sep 2012 07:38:57 +0000
Subject: Fix clashing symbol "error" in amalgamation build.

git-svn-id: http://svn.drobilla.net/serd/trunk@384 490d8e77-9747-427b-9fa3-0b8f29cee8a0
---
 NEWS         |  3 ++-
 src/reader.c | 32 ++++++++++++++++----------------
 src/writer.c |  8 ++++----
 wscript      |  2 +-
 4 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/NEWS b/NEWS
index 87c89427..394252ad 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
 serd (0.18.1) unstable;
 
   * Disable timestamps in HTML documentation for reproducible build
+  * Fix clashing symbol "error" in amalgamation build
 
- -- David Robillard <d@drobilla.net>  Sun, 09 Sep 2012 03:19:01 -0400
+ -- David Robillard <d@drobilla.net>  Sun, 09 Sep 2012 03:38:08 -0400
 
 serd (0.18.0) stable;
 
diff --git a/src/reader.c b/src/reader.c
index d17b80a5..c97228d3 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -92,7 +92,7 @@ struct SerdReaderImpl {
 };
 
 static int
-error(SerdReader* reader, SerdStatus st, const char* fmt, ...)
+r_err(SerdReader* reader, SerdStatus st, const char* fmt, ...)
 {
 	va_list args;
 	va_start(args, fmt);
@@ -152,7 +152,7 @@ eat_byte_check(SerdReader* reader, const uint8_t byte)
 {
 	const uint8_t c = peek_byte(reader);
 	if (c != byte) {
-		return error(reader, SERD_ERR_BAD_SYNTAX,
+		return r_err(reader, SERD_ERR_BAD_SYNTAX,
 		             "expected `%c', not `%c'\n", byte, c);
 	}
 	return eat_byte_safe(reader, byte);
@@ -275,7 +275,7 @@ read_hex(SerdReader* reader)
 	if (in_range(c, 0x30, 0x39) || in_range(c, 0x41, 0x46)) {
 		return eat_byte_safe(reader, c);
 	} else {
-		return error(reader, SERD_ERR_BAD_SYNTAX,
+		return r_err(reader, SERD_ERR_BAD_SYNTAX,
 		             "invalid hexadecimal digit `%c'\n", c);
 	}
 }
@@ -303,7 +303,7 @@ read_hex_escape(SerdReader* reader, unsigned length, Ref dest)
 	} else if (c < 0x00110000) {
 		size = 4;
 	} else {
-		error(reader, SERD_ERR_BAD_SYNTAX,
+		r_err(reader, SERD_ERR_BAD_SYNTAX,
 		      "unicode character 0x%X out of range\n", c);
 		push_replacement(reader, dest);
 		return true;
@@ -404,7 +404,7 @@ read_ucharacter_escape(SerdReader* reader, Ref dest)
 static inline SerdStatus
 bad_char(SerdReader* reader, Ref dest, const char* fmt, uint8_t c)
 {
-	error(reader, SERD_ERR_BAD_SYNTAX, fmt, c);
+	r_err(reader, SERD_ERR_BAD_SYNTAX, fmt, c);
 	push_replacement(reader, dest);
 
 	// Skip bytes until the next start byte
@@ -460,7 +460,7 @@ read_character(SerdReader* reader, Ref dest)
 	const uint8_t c = peek_byte(reader);
 	assert(c != '\\');  // Only called from methods that handle escapes first
 	if (c == '\0') {
-		error(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of input\n", c);
+		r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of input\n", c);
 		return SERD_ERR_BAD_SYNTAX;
 	} else if (c < 0x20) {
 		return bad_char(reader, dest,
@@ -499,7 +499,7 @@ read_lcharacter(SerdReader* reader, Ref dest, SerdNodeFlags* flags)
 		if (read_scharacter_escape(reader, dest, flags)) {
 			return SERD_SUCCESS;
 		} else {
-			error(reader, SERD_ERR_BAD_SYNTAX,
+			r_err(reader, SERD_ERR_BAD_SYNTAX,
 			      "invalid escape `\\%c'\n", peek_byte(reader));
 			return SERD_ERR_BAD_SYNTAX;
 		}
@@ -524,7 +524,7 @@ read_scharacter(SerdReader* reader, Ref dest, SerdNodeFlags* flags)
 		if (read_scharacter_escape(reader, dest, flags)) {
 			return SERD_SUCCESS;
 		} else {
-			error(reader, SERD_ERR_BAD_SYNTAX,
+			r_err(reader, SERD_ERR_BAD_SYNTAX,
 			      "invalid escape `\\%c'\n", peek_byte(reader));
 			return SERD_ERR_BAD_SYNTAX;
 		}
@@ -547,7 +547,7 @@ read_ucharacter(SerdReader* reader, Ref dest)
 		if (read_ucharacter_escape(reader, dest)) {
 			return SERD_SUCCESS;
 		} else {
-			error(reader, SERD_ERR_BAD_SYNTAX,
+			r_err(reader, SERD_ERR_BAD_SYNTAX,
 			      "invalid escape `\\%c'\n", peek_byte(reader));
 			return SERD_FAILURE;
 		}
@@ -716,7 +716,7 @@ read_prefixName(SerdReader* reader, Ref dest)
 {
 	uint8_t c = peek_byte(reader);
 	if (c == '_') {
-		error(reader, SERD_ERR_BAD_SYNTAX, "unexpected `_'\n");
+		r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected `_'\n");
 		return pop_node(reader, dest);
 	}
 	TRY_RET(c = read_nameStartChar(reader));
@@ -750,7 +750,7 @@ read_language(SerdReader* reader)
 {
 	uint8_t c = peek_byte(reader);
 	if (!in_range(c, 'a', 'z')) {
-		return error(reader, SERD_ERR_BAD_SYNTAX, "unexpected `%c'\n", c);
+		return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected `%c'\n", c);
 	}
 	Ref ref = push_node(reader, SERD_LITERAL, "", 0);
 	push_byte(reader, ref, eat_byte_safe(reader, c));
@@ -804,7 +804,7 @@ read_0_9(SerdReader* reader, Ref str, bool at_least_one)
 	uint8_t c;
 	if (at_least_one) {
 		if (!is_digit((c = peek_byte(reader)))) {
-			return error(reader, SERD_ERR_BAD_SYNTAX, "expected digit\n");
+			return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected digit\n");
 		}
 		push_byte(reader, str, eat_byte_safe(reader, c));
 	}
@@ -966,7 +966,7 @@ read_nodeID(SerdReader* reader)
 	                    reader->bprefix ? (char*)reader->bprefix : "",
 	                    reader->bprefix_len);
 	if (!read_name(reader, ref)) {
-		return error(reader, SERD_ERR_BAD_SYNTAX,
+		return r_err(reader, SERD_ERR_BAD_SYNTAX,
 		             "invalid character at start of name\n");
 	}
 	if (reader->syntax == SERD_TURTLE) {
@@ -975,7 +975,7 @@ read_nodeID(SerdReader* reader)
 			memcpy((char*)buf, "docid", 5);  // Prevent clash
 			reader->seen_genid = true;
 		} else if (reader->seen_genid && !strncmp(buf, "docid", 5)) {
-			error(reader, SERD_ERR_ID_CLASH,
+			r_err(reader, SERD_ERR_ID_CLASH,
 			      "found both `genid' and `docid' IDs, prefix required\n");
 			return pop_node(reader, ref);
 		}
@@ -1049,7 +1049,7 @@ read_blank(SerdReader* reader, ReadContext ctx, bool subject, Ref* dest)
 	case '(':
 		return read_collection(reader, ctx, dest);
 	default:
-		return error(reader, SERD_ERR_BAD_SYNTAX, "invalid blank node\n");
+		return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid blank node\n");
 	}
 }
 
@@ -1321,7 +1321,7 @@ read_directive(SerdReader* reader)
 	switch (peek_byte(reader)) {
 	case 'b': return read_base(reader);
 	case 'p': return read_prefixID(reader);
-	default:  return error(reader, SERD_ERR_BAD_SYNTAX, "invalid directive\n");
+	default:  return r_err(reader, SERD_ERR_BAD_SYNTAX, "invalid directive\n");
 	}
 }
 
diff --git a/src/writer.c b/src/writer.c
index 84a5d43b..86fe482a 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -103,7 +103,7 @@ typedef enum {
 } TextContext;
 
 static void
-error(SerdWriter* writer, SerdStatus st, const char* fmt, ...)
+w_err(SerdWriter* writer, SerdStatus st, const char* fmt, ...)
 {
 	va_list args;
 	va_start(args, fmt);
@@ -219,7 +219,7 @@ write_text(SerdWriter* writer, TextContext ctx,
 			size = 4;
 			c    = in & 0x07;
 		} else {
-			error(writer, SERD_ERR_BAD_ARG, "invalid UTF-8: %X\n", in);
+			w_err(writer, SERD_ERR_BAD_ARG, "invalid UTF-8: %X\n", in);
 			const uint8_t replacement_char[] = { 0xEF, 0xBF, 0xBD };
 			len += sink(replacement_char, sizeof(replacement_char), writer);
 			return len;
@@ -364,7 +364,7 @@ write_node(SerdWriter*        writer,
 		switch (writer->syntax) {
 		case SERD_NTRIPLES:
 			if (serd_env_expand(writer->env, node, &uri_prefix, &uri_suffix)) {
-				error(writer, SERD_ERR_BAD_CURIE,
+				w_err(writer, SERD_ERR_BAD_CURIE,
 				      "undefined namespace prefix `%s'\n", node->buf);
 				return false;
 			}
@@ -603,7 +603,7 @@ serd_writer_end_anon(SerdWriter*     writer,
 		return SERD_SUCCESS;
 	}
 	if (serd_stack_is_empty(&writer->anon_stack)) {
-		error(writer, SERD_ERR_UNKNOWN,
+		w_err(writer, SERD_ERR_UNKNOWN,
 		      "unexpected end of anonymous node\n");
 		return SERD_ERR_UNKNOWN;
 	}
diff --git a/wscript b/wscript
index 206a8d9f..f1612342 100644
--- a/wscript
+++ b/wscript
@@ -8,7 +8,7 @@ from waflib.extras import autowaf as autowaf
 import waflib.Logs as Logs, waflib.Options as Options
 
 # Version of this package (even if built as a child)
-SERD_VERSION       = '0.18.0'
+SERD_VERSION       = '0.18.1'
 SERD_MAJOR_VERSION = '0'
 
 # Library version (UNIX style major, minor, micro)
-- 
cgit v1.2.1