From 11a1d1a73d3ab40744692735597b0dd2a572444e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 29 Sep 2013 10:10:51 +0000 Subject: revert accidental revert --- qdepends.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'qdepends.c') diff --git a/qdepends.c b/qdepends.c index 368b6341..f5a86099 100644 --- a/qdepends.c +++ b/qdepends.c @@ -1,7 +1,7 @@ /* * Copyright 2005-2013 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.63 2013/09/29 10:07:28 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.64 2013/09/29 10:10:51 vapier Exp $ * * Copyright 2005-2010 Ned Ludd - * Copyright 2005-2013 Mike Frysinger - @@ -32,7 +32,7 @@ static const char * const qdepends_opts_help[] = { "Pretty format specified depend strings", COMMON_OPTS_HELP }; -static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.63 2013/09/29 10:07:28 vapier Exp $"; +static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.64 2013/09/29 10:10:51 vapier Exp $"; #define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends")) static char qdep_name_only = 0; @@ -146,6 +146,7 @@ void _dep_attach(dep_node *root, dep_node *attach_me, int type) _q_static dep_node *dep_grow_tree(const char *depend) { + bool saw_whitespace; signed long paren_balanced; const char *ptr, *word; int curr_attach; @@ -175,8 +176,10 @@ _q_static dep_node *dep_grow_tree(const char *depend) word = NULL; \ } while (0) + saw_whitespace = true; for (ptr = depend; *ptr; ++ptr) { if (isspace(*ptr)) { + saw_whitespace = true; _maybe_consume_word(DEP_NORM); continue; } @@ -192,6 +195,8 @@ _q_static dep_node *dep_grow_tree(const char *depend) continue; } case '|': { + if (!saw_whitespace) + break; if (ptr[1] != '|') { warnf("Found a | but not ||"); goto error_out; @@ -203,6 +208,8 @@ _q_static dep_node *dep_grow_tree(const char *depend) } case '(': { ++paren_balanced; + if (!saw_whitespace) + break; if (prev_type == DEP_OR || prev_type == DEP_USE) { _maybe_consume_word(DEP_NORM); prev_type = DEP_NULL; @@ -219,6 +226,8 @@ _q_static dep_node *dep_grow_tree(const char *depend) } case ')': { --paren_balanced; + if (!saw_whitespace) + break; _maybe_consume_word(DEP_NORM); if (curr_node->parent == NULL) { @@ -233,6 +242,7 @@ _q_static dep_node *dep_grow_tree(const char *depend) if (!word) word = ptr; } + saw_whitespace = false; /* fall through to the paren failure below */ if (paren_balanced < 0) -- cgit v1.2.3-65-gdbad