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

Bryce Harrington bryce at osg.samsung.com
Thu Nov 5 14:20:04 PST 2015


On Fri, Nov 06, 2015 at 08:01:59AM +1000, Peter Hutterer wrote:
> 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>

Easy enough.

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>
> ---
>  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
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list