Ignore non-matching regex renames when searching renames list.

Skip over %renames with non-matching %(regex)s expansion when looking for the
one to apply to the given name. This allows to have multiple anonymous renames
using regex as now the first _matching_ one will be used instead of always
using the first one and ignoring all the rest of them.

Extend unit tests to verify that applying two anonymous %renames does work as
expected.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12293 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vadim Zeitlin 2010-11-16 14:09:39 +00:00
commit f6cab0170a
6 changed files with 53 additions and 3 deletions

View file

@ -1302,7 +1302,13 @@ Hash *Swig_name_nameobj_lget(List *namelist, Node *n, String *prefix, String *na
: Swig_name_match_value(tname, sname);
Delete(sname);
} else {
match = 1;
/* Applying the renaming rule may fail if it contains a %(regex)s expression that doesn't match the given name. */
String *sname = NewStringf(Getattr(rn, "name"), name);
if (sname) {
if (Len(sname))
match = 1;
Delete(sname);
}
}
}
if (match) {