From ebe1d5b678622345d5eee849feb24d2fbdeb2ced Mon Sep 17 00:00:00 2001 From: cathugger Date: Thu, 12 Jul 2018 13:05:53 +0000 Subject: [PATCH] delet trailing whitespace --- base64.h | 2 +- test_base16.c | 2 +- test_base32.c | 6 +++--- test_ed25519.c | 2 +- yaml.c | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/base64.h b/base64.h index 1d723bc..38ae42e 100644 --- a/base64.h +++ b/base64.h @@ -10,4 +10,4 @@ size_t base64_from(u8 *dst,const char *src,size_t slen); // returns 1 if whole string is good, 0 if string contains invalid data int base64_valid(const char *src,size_t *count); // aligns data length to something base64 can represent without padding -#define BASE64_DATA_ALIGN(l) (((l + 2) / 3) * 3) +#define BASE64_DATA_ALIGN(l) ((((l) + 2) / 3) * 3) diff --git a/test_base16.c b/test_base16.c index 3f3aacd..7116a77 100644 --- a/test_base16.c +++ b/test_base16.c @@ -45,6 +45,6 @@ int main(void) //fprintf(stderr, "%s -- %s\n", buf2, tests0[i].rev); assert(strcmp(buf2, tests0[i].rev) == 0); } - + return 0; } diff --git a/test_base32.c b/test_base32.c index 4347ff8..2a81598 100644 --- a/test_base32.c +++ b/test_base32.c @@ -23,7 +23,7 @@ struct texttestcase { /* r:0, mask:FF - -- + -- r:2, mask:C0 f -- f r:3, mask:F0 @@ -75,10 +75,10 @@ int main(void) //fprintf(stderr, "%s -- %s\n", buf2, tests0[i].rev); assert(strcmp(buf2, tests0[i].rev) == 0); } - + //randombytes_buf(buf, 128); //base32_to(buf2, (const u8 *)buf, 128); //fprintf(stderr, ">%s\n", buf2); - + return 0; } diff --git a/test_ed25519.c b/test_ed25519.c index d921d03..968d660 100644 --- a/test_ed25519.c +++ b/test_ed25519.c @@ -61,6 +61,6 @@ int main(void) fprintf(stderr, "expected: %s got %s\n", str1, str2); } } - + return 0; } diff --git a/yaml.c b/yaml.c index 7c6c85e..5e20a8e 100644 --- a/yaml.c +++ b/yaml.c @@ -139,17 +139,17 @@ int yamlin_parseandcreate(FILE *fin,char *sname,const char *hostname) while (!feof(fin) && !ferror(fin)) { if (!fgets(line,sizeof(line),fin)) break; - + len = strlen(line); - + // trim whitespace from the end while (len != 0 && (line[len-1] == ' ' || line[len-1] == '\n' || line[len-1] == '\r')) line[--len] = '\0'; - + // skip empty lines if (len == 0) continue; - + if (len >= 3 && line[0] == '-' && line[1] == '-' && line[2] == '-') { // end of document indicator if (!skipthis && (hashost || haspub || hassec)) { @@ -159,10 +159,10 @@ int yamlin_parseandcreate(FILE *fin,char *sname,const char *hostname) hashost = haspub = hassec = skipthis = 0; continue; } - + if (skipthis) continue; - + char *start = line; // trim whitespace while (len != 0 && *start == ' ') {