[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] ifupdown: support post-up / pre-down hooks
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2011-10-19 0:38:27
Message-ID: 201110190238.27193.vda.linux () googlemail ! com
[Download RAW message or body]

On Thursday 06 October 2011 17:02, Ralf Friedl wrote:
> Peter Korsgaard wrote:
> > diff --git a/networking/ifupdown.c b/networking/ifupdown.c
> > index 3820330..abc6b58 100644
> > --- a/networking/ifupdown.c
> > +++ b/networking/ifupdown.c
> > @@ -891,6 +891,8 @@ static struct interfaces_file_t *read_interfaces(const char *filename)
> >  				if (strcmp(first_word, "up") != 0
> >  				 && strcmp(first_word, "down") != 0
> >  				 && strcmp(first_word, "pre-up") != 0
> > +				 && strcmp(first_word, "pre-down") != 0
> > +				 && strcmp(first_word, "post-up") != 0
> >  				 && strcmp(first_word, "post-down") != 0
> >  				) {
> >  					int i;
> > @@ -987,6 +989,8 @@ static void set_environ(struct interface_defn_t *iface, const char *mode)
> >  		if (strcmp(iface->option[i].name, "up") == 0
> >  		 || strcmp(iface->option[i].name, "down") == 0
> >  		 || strcmp(iface->option[i].name, "pre-up") == 0
> > +		 || strcmp(iface->option[i].name, "pre-down") == 0
> > +		 || strcmp(iface->option[i].name, "post-up") == 0
> >  		 || strcmp(iface->option[i].name, "post-down") == 0
> >  		) {
> >  			continue;
> >   
> This seems to be a good candidate for:
> 
> static const char keywords_up_down[] ALIGN1 = "up\0" "down\0" "pre-up\0" 
> "pre-down\0" "post-up\0" "post-down\0" ;
> 
>     if (index_in_substrings(keywords_up_down, first_word) < 0)
> 
>     if (index_in_substrings(keywords_up_down, iface->option[i].name >= 0)

why in SUBstrings?

(done in git)

-- 
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic