aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-06 10:34:55 +0200
committerDavid Robillard <d@drobilla.net>2020-07-06 10:34:55 +0200
commit9f17e7498c9527c85e292914f7e874c045dccc75 (patch)
tree6049662546a912eed501b54642b400fb73ea319d
parented4c28d84c9411e46a0a53efc97c4966ef7ad3d7 (diff)
downloadserd-9f17e7498c9527c85e292914f7e874c045dccc75.tar.gz
serd-9f17e7498c9527c85e292914f7e874c045dccc75.tar.bz2
serd-9f17e7498c9527c85e292914f7e874c045dccc75.zip
Fix spurious semicolon warnings
-rw-r--r--src/n3.c4
-rw-r--r--src/node.c10
-rw-r--r--src/serdi.c4
-rw-r--r--src/writer.c8
4 files changed, 14 insertions, 12 deletions
diff --git a/src/n3.c b/src/n3.c
index 0098e5a1..f8c4ccca 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -27,8 +27,8 @@
#include <stdlib.h>
#include <string.h>
-#define TRY_THROW(exp) if (!(exp)) goto except;
-#define TRY_RET(exp) if (!(exp)) return 0;
+#define TRY_THROW(exp) do { if (!(exp)) goto except; } while (0)
+#define TRY_RET(exp) do { if (!(exp)) return 0; } while (0)
static inline bool
fancy_syntax(const SerdReader* reader)
diff --git a/src/node.c b/src/node.c
index ea9168bd..a66123ef 100644
--- a/src/node.c
+++ b/src/node.c
@@ -99,11 +99,11 @@ serd_uri_string_length(const SerdURI* uri)
#define ADD_LEN(field, n_delims) \
if ((field).len) { len += (field).len + (n_delims); }
- ADD_LEN(uri->path, 1); // + possible leading `/'
- ADD_LEN(uri->scheme, 1); // + trailing `:'
- ADD_LEN(uri->authority, 2); // + leading `//'
- ADD_LEN(uri->query, 1); // + leading `?'
- ADD_LEN(uri->fragment, 1); // + leading `#'
+ ADD_LEN(uri->path, 1) // + possible leading `/'
+ ADD_LEN(uri->scheme, 1) // + trailing `:'
+ ADD_LEN(uri->authority, 2) // + leading `//'
+ ADD_LEN(uri->query, 1) // + leading `?'
+ ADD_LEN(uri->fragment, 1) // + leading `#'
return len + 2; // + 2 for authority `//'
}
diff --git a/src/serdi.c b/src/serdi.c
index 802a6ff5..31e4ff91 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -29,8 +29,8 @@
#include <stdio.h>
#include <string.h>
-#define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg);
-#define SERDI_ERRORF(fmt, ...) fprintf(stderr, "serdi: " fmt, __VA_ARGS__);
+#define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg)
+#define SERDI_ERRORF(fmt, ...) fprintf(stderr, "serdi: " fmt, __VA_ARGS__)
typedef struct {
SerdSyntax syntax;
diff --git a/src/writer.c b/src/writer.c
index f4edf731..9881f00f 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -697,9 +697,11 @@ serd_writer_write_statement(SerdWriter* writer,
}
#define TRY(write_result) \
- if (!(write_result)) { \
- return SERD_ERR_UNKNOWN; \
- }
+ do { \
+ if (!(write_result)) { \
+ return SERD_ERR_UNKNOWN; \
+ } \
+ } while (0)
switch (writer->syntax) {
case SERD_NTRIPLES: