[pacman-dev] [PATCH 8/9] ini.c: remove useless key check

Andrew Gregory andrew.gregory.8 at gmail.com
Mon Dec 29 04:25:22 UTC 2014


On 12/29/14 at 02:13pm, Allan McRae wrote:
> On 27/04/14 09:57, Andrew Gregory wrote:
> > key points to a statically allocated string, it can't be NULL.
> > 
> 
> It looks like this is supposed to lines like:
> [    ]
> 
> in the config file.
> 
> Should the test be key == '\0'?

No check is necessary, the callback will reject empty keys.  I'll add
a note to the commit message.

> > Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> > ---
> >  src/pacman/ini.c | 6 ------
> >  1 file changed, 6 deletions(-)
> > 
> > diff --git a/src/pacman/ini.c b/src/pacman/ini.c
> > index a8c4c04..dec3eb0 100644
> > --- a/src/pacman/ini.c
> > +++ b/src/pacman/ini.c
> > @@ -104,12 +104,6 @@ int parse_ini(const char *file, ini_parser_fn cb, void *data)
> >  		strtrim(key);
> >  		strtrim(value);
> >  
> > -		if(key == NULL) {
> > -			pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: syntax error in config file- missing key.\n"),
> > -					file, linenum);
> > -			ret = 1;
> > -			goto cleanup;
> > -		}
> >  		if((ret = cb(file, linenum, section_name, key, value, data)) != 0) {
> >  			goto cleanup;
> >  		}
> > 


More information about the pacman-dev mailing list