[PATCH] Avoid side effects in putc(), which may be implemented as a macro
Denys Vlasenko
vda.linux at googlemail.com
Wed Sep 8 12:24:02 UTC 2010
On Wed, Sep 8, 2010 at 8:40 AM, Dan Fandrich <dan at coneharvesters.com> wrote:
> Signed-off-by: Dan Fandrich <dan at coneharvesters.com>
> ---
> coreutils/ls.c | 4 ++--
> coreutils/tee.c | 8 ++++----
> shell/ash.c | 6 ++++--
> 3 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/coreutils/ls.c b/coreutils/ls.c
> index cbfcfc7..db84e9d 100644
> --- a/coreutils/ls.c
> +++ b/coreutils/ls.c
> @@ -568,12 +568,12 @@ static unsigned print_name(const char *name)
>
> len = 2 + uni_stat.unicode_width;
> putchar('"');
> - while (*name) {
> + for (; *name; ++name) {
Please, do not convert it to for(). I like while().
> while (*p != '=')
> - putc(*p++, fp);
> + putc(*p, fp);
> + ++p;
This definitely looks wrong. You need to add {}s.
--
vda
More information about the busybox
mailing list