From a1a5b5e5d7e269aafd00319ebfbb933a43c4ce8d Mon Sep 17 00:00:00 2001 From: Tim Ruehsen Date: Wed, 18 Jun 2014 16:27:29 +0200 Subject: [PATCH] fixed c89 compatibility --- src/psl.c | 2 ++ tools/psl.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/psl.c b/src/psl.c index 7b5a7f6..a1a7d3f 100644 --- a/src/psl.c +++ b/src/psl.c @@ -877,6 +877,7 @@ int psl_str_to_utf8lower(const char *str, const char *encoding, const char *loca } #ifdef WITH_LIBICU + do { size_t str_length = strlen(str); UErrorCode status = 0; UChar *utf16_dst, *utf16_lower; @@ -918,6 +919,7 @@ int psl_str_to_utf8lower(const char *str, const char *encoding, const char *loca ret = -2; /* fprintf(stderr, "Failed to open converter for '%s' (status %d)\n", encoding, status); */ } + } while (0); #endif return ret; diff --git a/tools/psl.c b/tools/psl.c index 5a6a9cc..80f0933 100644 --- a/tools/psl.c +++ b/tools/psl.c @@ -151,11 +151,11 @@ int main(int argc, const char *const *argv) size_t len; int rc; - // read URLs from STDIN + /* read URLs from STDIN */ while (fgets(buf, sizeof(buf), stdin)) { - for (domain = buf; isspace(*domain); domain++); // skip leading spaces - if (*domain == '#' || !*domain) continue; // skip empty lines and comments - for (len = strlen(domain); len && isspace(domain[len - 1]); len--); // skip trailing spaces + for (domain = buf; isspace(*domain); domain++); /* skip leading spaces */ + if (*domain == '#' || !*domain) continue; /* skip empty lines and comments */ + for (len = strlen(domain); len && isspace(domain[len - 1]); len--); /* skip trailing spaces */ domain[len] = 0; if ((rc = psl_str_to_utf8lower(domain, NULL, NULL, &lower)) != 0)