From: Rusty Russell Date: Sun, 29 Mar 2009 06:01:02 +0000 (+1030) Subject: Another Joey fix: X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=02005621033206078929b388f13afc69a6688094;hp=7c71ddab47d9b06aa140f305c956e454d711e66e Another Joey fix: (15:30:58) joeyadams: Also, ccanlint detects "trailing newlines" on empty lines. Is this a bug, or is it policy? (15:52:03) joeyadams: In my code, I like to keep blank lines in my routines indented to the associated level so automatic indent will apply there --- diff --git a/tools/ccanlint/trailing_whitespace.c b/tools/ccanlint/trailing_whitespace.c index df1ce772..537e955e 100644 --- a/tools/ccanlint/trailing_whitespace.c +++ b/tools/ccanlint/trailing_whitespace.c @@ -5,8 +5,13 @@ static char *report_on_trailing_whitespace(const char *line) { - if (!strends(line, " ") && !strends(line, "\t")) - return NULL; + const char *e = strchr(line, 0); + while (e>line && (e[-1]==' ' || e[-1]=='\t')) + e--; + if (*e == 0) + return NULL; //there were no trailing spaces + if (e == line) + return NULL; //the line only consists of spaces if (strlen(line) > 20) return talloc_asprintf(line, "...'%s'",