aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-15 23:54:50 +0000
committerDavid Robillard <d@drobilla.net>2011-05-15 23:54:50 +0000
commit9947012c89a2e965d2871b8b5417d9cd8adff2fd (patch)
tree41cbc523e7cbadb981a1c5daeff0dc4b67f5cdab
parentee9291e3fcdcd9984e1853941f7fffb4d5873d61 (diff)
downloadserd-9947012c89a2e965d2871b8b5417d9cd8adff2fd.tar.gz
serd-9947012c89a2e965d2871b8b5417d9cd8adff2fd.tar.bz2
serd-9947012c89a2e965d2871b8b5417d9cd8adff2fd.zip
Remove dead code found by clang static analyser.
git-svn-id: http://svn.drobilla.net/serd/trunk@180 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r--src/serdi.c2
-rw-r--r--src/uri.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/src/serdi.c b/src/serdi.c
index 1d6a8663..91cffe46 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -133,7 +133,7 @@ main(int argc, char** argv)
const uint8_t* base_uri_str = NULL;
SerdURI base_uri;
if (a < argc) { // Base URI given on command line
- const uint8_t* const in_base_uri = (const uint8_t*)argv[a++];
+ const uint8_t* const in_base_uri = (const uint8_t*)argv[a];
if (serd_uri_parse((const uint8_t*)in_base_uri, &base_uri)) {
fprintf(stderr, "Invalid base URI <%s>\n", argv[2]);
return 1;
diff --git a/src/uri.c b/src/uri.c
index 958ba7da..4f1ef3a5 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -32,7 +32,7 @@ serd_uri_string_has_scheme(const uint8_t* utf8)
if (!is_alpha(utf8[0])) {
return false; // Invalid scheme initial character, URI is relative
}
- for (uint8_t c = *++utf8; (c = *utf8) != '\0'; ++utf8) {
+ for (uint8_t c; (c = *++utf8) != '\0';) {
switch (c) {
case ':':
return true; // End of scheme
@@ -113,7 +113,7 @@ maybe_authority:
ptr += 2;
uri->authority.buf = ptr;
assert(uri->authority.len == 0);
- for (uint8_t c = *ptr; (c = *ptr) != '\0'; ++ptr) {
+ for (uint8_t c; (c = *ptr) != '\0'; ++ptr) {
switch (c) {
case '/': goto path;
case '?': goto query;
@@ -136,7 +136,7 @@ path:
}
uri->path.buf = ptr;
uri->path.len = 0;
- for (uint8_t c = *ptr; (c = *ptr) != '\0'; ++ptr) {
+ for (uint8_t c; (c = *ptr) != '\0'; ++ptr) {
switch (c) {
case '?': goto query;
case '#': goto fragment;
@@ -152,7 +152,7 @@ path:
query:
if (*ptr == '?') {
uri->query.buf = ++ptr;
- for (uint8_t c = *ptr; (c = *ptr) != '\0'; ++ptr) {
+ for (uint8_t c; (c = *ptr) != '\0'; ++ptr) {
switch (c) {
case '#':
goto fragment;
@@ -268,11 +268,11 @@ serd_uri_serialise(const SerdURI* uri, SerdSink sink, void* stream)
See http://tools.ietf.org/html/rfc3986#section-5.2.3
*/
const uint8_t* begin = uri->path.buf;
- const uint8_t* end = begin;
- size_t up = 1;
+ size_t up = 1;
+
if (begin) {
// Count and skip leading dot components
- end = uri->path.buf + uri->path.len;
+ const uint8_t* end = uri->path.buf + uri->path.len;
for (bool done = false; !done && (begin < end);) {
switch (begin[0]) {
case '.':