[PATCH] convert local constant arrays to static

Rob Landley rob at landley.net
Wed Feb 22 15:42:43 UTC 2006


On Wednesday 22 February 2006 2:00 am, Denis Vlasenko wrote:
> Hello,
>
> Patch basically does this:
>
> -               char *extn[] = {"", ".zip", ".ZIP"};
> +               static const char *const extn[] = {"", ".zip", ".ZIP"};
>
> in several places. '*const' pointers are used instead
> of just '*' to let compiler check that there is no
> assignments to array members.

Ok.  Since const is a compile time check, if it still builds without warnings 
it should all be good. :)

> Rob, can you look at the hunk where I made cleanenv[]
> static? I'm not 100% sure it's ok to do so...

That should be fine.  Even if const managed to throw the data into a read-only 
segment (which I don't think it does), execve() copies the data into the new 
process's environment anyway.

Just a note that devfsd can be considered deprecated, and will probably be 
dropped in 1.2.  (Not 1.1.2, which shouldn't break anything, but the next 
place up.)

> A few small unrelated fixes are also there.

Generally looks good.

(Pondering the "statics" you added, but I think I've worked out what the 
compiler should be doing with that.)

The mount.c change I'll have to commit later because it doesn't currently 
apply to my tree.  (I need to finish that up and commit it...)

> --
> vda

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list