On 2011-01-31 at 16:19:33 +0100, Karel Zak <kzak@xxxxxxxxxx> wrote: > On Mon, Jan 24, 2011 at 10:23:23AM +0100, Tobias Klauser wrote: > > On 2011-01-23 at 20:46:31 +0100, Karel Zak <kzak@xxxxxxxxxx> wrote: > > > On Fri, Jan 21, 2011 at 04:44:18PM +0100, Tobias Klauser wrote: > > > > Also constify the option array. > > > > > > Please, could be more verbose? Why we need this patch? > > > > Sorry about that. > > > > I was running sparse against util-linux-ng and it warned about the > > global symbols: > > > > swapon.c:61:5: warning: symbol 'all' was not declared. Should it be static? > > swapon.c:62:5: warning: symbol 'priority' was not declared. Should it be static? > > swapon.c:63:5: warning: symbol 'discard' was not declared. Should it be static? > > swapon.c:66:5: warning: symbol 'ifexists' was not declared. Should it be static? > > swapon.c:67:5: warning: symbol 'fixpgsz' was not declared. Should it be static? > > swapon.c:69:5: warning: symbol 'verbose' was not declared. Should it be static? > > swapon.c:70:6: warning: symbol 'progname' was not declared. Should it be static? > > > > While there I noticed the option array not being const which usually is > > the case as these arrays tend not to be modified. > > > > There are sparse warnings in other parts too. Are you OK with such > > patches (e.g. shall I submit them) or is this just nitpicking? > > Applied, thanks ...but it's nitpicking ;-) Ok, I'll leave them alone then :-) Thanks. > > > > -static struct option longswaponopts[] = { > > > > +static const struct option longswaponopts[] = { > > > > /* swapon only */ > > > > { "priority", required_argument, 0, 'p' }, > > > > { "discard", 0, 0, 'd' }, > > > > @@ -84,7 +84,7 @@ static struct option longswaponopts[] = { > > > > { NULL, 0, 0, 0 } > > > > }; > > > > > > > > -static struct option *longswapoffopts = &longswaponopts[4]; > > > > +static const struct option *longswapoffopts = &longswaponopts[4]; > > This is probably more serious that the "static" stuff. I think there > is many other places in the u-l code where "const" makes sense. I'll look into these and send patches then, if that's OK with you. Arrays of struct option seem to be a good starting point. Tobias -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html