Am 21.02.2014 um 03:54 schrieb Ted Unangst <t...@tedunangst.com>:

> While I was poking around yacc, I noticed that skeleton.c used a
> handrolled fputs instead of calling the function. Fixing that, I
> noticed the code wasn't indented nicely. Fixing that, I figured if
> I've already messed with output.c, I should indent that file too.
> 
> Which brings us this. The functional change to skeleton.c is all the
> way at the bottom. Otherwise it mostly replaces four spaces with a
> tab, except where it replaces two spaces with a tab, except where it
> replaces some other amount of whitespace.

[...]

> void
> write_section(char *section[])
> {
> -    int c;
> -    int i;
> -    char *s;
> -    FILE *f;
> -
> -    f = code_file;
> -    for (i = 0; (s = section[i]); ++i)
> -    {
> -     ++outline;
> -     while ((c = *s))
> -     {
> -         putc(c, f);
> -         ++s;
> +     int c;

You do not need c here anymore, right?

> +     int i;
> +     char *s;
> +     FILE *f;
> +
> +     f = code_file;

Why not shorten to FILE *f = code_file; ?

> +     for (i = 0; (s = section[i]); ++i) {
> +             ++outline;
> +             fputs(s, f);
> +             putc('\n', f);

Why this local assignment to f anyway and not 
just fputs(s, code_file) and putc(\n', code_file)?

>       }
> -     putc('\n', f);
> -    }
> }

Otherwise, ok jung@

Reply via email to