[pacman-dev] [PATCH 7/9] ini.c: remove empty section name restriction

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


On 12/29/14 at 02:07pm, Allan McRae wrote:
> On 27/04/14 09:57, Andrew Gregory wrote:
> > Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> > ---
> 
> Why?   This seems a reasonable restriction.

To move the error handling out of the ini parser.  alpm will already
reject an empty db name.  I'll add a commit message to that effect.

> >  src/pacman/ini.c | 7 -------
> >  1 file changed, 7 deletions(-)
> > 
> > diff --git a/src/pacman/ini.c b/src/pacman/ini.c
> > index 5c5232d..a8c4c04 100644
> > --- a/src/pacman/ini.c
> > +++ b/src/pacman/ini.c
> > @@ -81,13 +81,6 @@ int parse_ini(const char *file, ini_parser_fn cb, void *data)
> >  
> >  		if(line[0] == '[' && line[line_len - 1] == ']') {
> >  			char *name;
> > -			/* only possibility here is a line == '[]' */
> > -			if(line_len <= 2) {
> > -				pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: bad section name.\n"),
> > -						file, linenum);
> > -				ret = 1;
> > -				goto cleanup;
> > -			}
> >  			/* new config section, skip the '[' */
> >  			name = strdup(line + 1);
> >  			name[line_len - 2] = '\0';
> > 


More information about the pacman-dev mailing list