[systemd-devel] [PATCH] fix strange addition idiom
Lennart Poettering
lennart at poettering.net
Wed Apr 13 16:46:23 PDT 2011
On Wed, 13.04.11 18:12, Kurt H Maier (karmaflux at gmail.com) wrote:
> --- systemd-pulled/src/reply-password.c 2011-04-13 18:05:52.873135496 -0400
> +++ systemd/src/reply-password.c 2011-04-13 18:07:59.832451810 -0400
> @@ -82,7 +82,7 @@
> }
>
> truncate_nl(packet+1);
> - length = 1 + strlen(packet+1) + 1;
> + length = 2 + strlen(packet+1);
I think we can leave it to the compiler to optimize this away.
I put it like this actually for a reason, to make clear that the final
packet consists of 1 char prefix, plus the main packet string plus a NUL
byte. In this order.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list