[BusyBox] [PATCH] compiler warning removal in strings.c
Tito
farmatito at tiscali.it
Mon Mar 3 06:29:05 UTC 2003
On Monday 03 March 2003 11:45, Stewart Brodie wrote:
> This patch is to stop compiler warnings from miscutils/strings.c about
> variables which may be used before being initialised.
>
> The variable "string" is passed to free() but may not be initialised. It
> may not be possible to reach the free without initialising the variable but
That's true ( I wrote that).
> I cannot be certain that my inspection of the code has not missed a
> code path. Initialising the value to NULL will remove any doubt. The
t is initialised at runtime
count=0;
t=count;
> variable "t" is now initialised to zero for safety.
I agree with you, looks better.
Hi Stewart,
If you're talking about strings.c in the development branch of busybox,
I've posted a similar patch on 19-02-2003 to the list but i didn't have write
access to CVS, so I hope that somebody will do that.
Please if you could take a look at line 86 , it seems to me that
it should be xmalloc(n+1) .
43c43
< long t, count;
---
> long t=0, count;
45c45
< char *string;
---
> char *string=NULL;
53c53
< opt++;
---
> opt+=1;
61,62c61
< opt++;
< opt++;
---
> opt+=2;
86c85
< string=xmalloc(n);
---
> string=xmalloc(n+1);
Please apply
Thanks
CIAO TITO
More information about the busybox
mailing list