[PATCH wayland 1/3] scanner: don't print trailing whitespaces

Peter Hutterer peter.hutterer at who-t.net
Thu Nov 5 14:01:59 PST 2015


If we're printing a zero-length string, we end up printing " * " and that
makes anything unhappy that doesn't handle trailing whitespaces.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/scanner.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/scanner.c b/src/scanner.c
index f456aa5..7b0f482 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1141,8 +1141,9 @@ format_copyright(const char *copyright)
 		}
 
 		if (copyright[i] == '\n' || copyright[i] == '\0') {
-			printf("%s %.*s\n",
+			printf("%s%s%.*s\n",
 			       i == 0 ? "/*" : " *",
+			       (i - start) == 0 ? "" : " ",
 			       i - start, copyright + start);
 			bol = 1;
 		}
-- 
2.4.3



More information about the wayland-devel mailing list