Re: [hackers] [sbase][PATCH] Fixed a couple of uninitialised variable warnings from Clang

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu, 2 Feb 2017 22:39:48 +0100

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
> _AT_@ -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
> _AT_@ -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 Thu Feb 02 2017 - 22:39:48 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 02 2017 - 22:48:18 CET