Re: [hackers] [sbase][PATCH] Fixed a couple of uninitialised variable warnings from Clang
Even if it makes no difference in join.c, silencing the compiler warning seems like a good thing. Everything else in sbase compiles with no warnings.
________________________________________
From: evilbob127_AT_gmail.com <evilbob127_AT_gmail.com> on behalf of Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Sent: 02 February 2017 21:39
To: hackers mail list
Subject: Re: [hackers] [sbase][PATCH] Fixed a couple of uninitialised variable warnings from Clang
Probably a false positive, but for ed.c it looks ok to me.
The join.c patch does not look ok to me (clang doesn't detect that
eprintf() exists the program), so it's a false positive.
On Thu, Feb 2, 2017 at 3:43 PM, Simon Cooksey <sjc205_AT_kent.ac.uk> wrote:
> - ed.c
> Initialise hline in `static int makeline(char, int)'
>
> - join.c
> Intitalise fileno and fldno in `static struct spec * makespec(char)'
> ---
> ed.c | 2 +-
> join.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ed.c b/ed.c
> index 4b28848..ae66b8d 100644
> --- a/ed.c
> +++ b/ed.c
> @@ -155,7 +155,7 @@ back(int c)
> static int
> makeline(char *s, int *off)
> {
> - struct hline *lp;
> + struct hline *lp = 0;
> size_t len;
> char c, *begin = s;
>
> diff --git a/join.c b/join.c
> index d3e2343..6145654 100644
> --- a/join.c
> +++ b/join.c
> @@ -314,8 +314,8 @@ static struct spec *
> makespec(char *s)
> {
> struct spec *sp;
> - int fileno;
> - size_t fldno;
> + int fileno = 0;
> + size_t fldno = 0;
>
> if (!strcmp(s, "0")) { /* join field must be 0 and nothing else */
> fileno = 0;
> --
> 2.11.0
>
>
Received on Fri Feb 03 2017 - 12:38:03 CET
This archive was generated by hypermail 2.3.0
: Fri Feb 03 2017 - 12:48:18 CET