From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Greg Jaskiewicz <gryzman(at)me(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: unused code in float8_to_char , formatting.c ? |
Date: | 2013-04-07 04:14:29 |
Message-ID: | CA+TgmoaafMp32Ji4rj1pg495xKzWOTeOjqWBFbQYtCmvZKKAkg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Apr 4, 2013 at 6:47 PM, Greg Jaskiewicz <gryzman(at)me(dot)com> wrote:
> Looking around the code Today, one of my helpful tools detected this dead code.
> As far as I can see, it is actually unused call to strlen() in formatting.c, float8_to_char().
I poked at this a little and suggest the following somewhat more
extensive cleanup.
It seems to me that there are a bunch of these functions where len is
unconditionally initialized in NUM_TOCHAR_prepare and then used there.
Similarly in NUM_TOCHAR_cleanup. And then there's a chunk of each
individual function that does it a third time. Rather than use the
same variable in all three places, I've moved the variable
declarations to the innermost possible scope. Doing that revealed a
bunch of other, similar places where we can get rid of strlen() calls.
Does this version seem like a good idea?
...Robert
Attachment | Content-Type | Size |
---|---|---|
formatting_dead_code_v2.diff | application/octet-stream | 3.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2013-04-07 04:18:49 | Re: Process title for autovac |
Previous Message | Tom Lane | 2013-04-07 02:16:20 | Re: isolation test fails on installcheck |