diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2013-03-04 07:32:40 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2013-03-04 07:32:40 +0000 |
commit | 670962cfe8d951004f927c803e505f23ee373d3a (patch) | |
tree | 8ab673f3d092cf6b8c4cd8947993c846afe84d7d /Lib/swigrun.swg | |
parent | df2388a459a5333fb3612869d96cd126f849f735 (diff) | |
download | swig-670962cfe8d951004f927c803e505f23ee373d3a.tar.gz |
SWIG_TypeCompare was not working as commented - return values were 0,1 and not 1,0,-1. Although undocumented and not used anywhere within SWIG, it has been replaced with SWIG_TypeCmp to work as commented.
Diffstat (limited to 'Lib/swigrun.swg')
-rw-r--r-- | Lib/swigrun.swg | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/Lib/swigrun.swg b/Lib/swigrun.swg index 999c87333..21f0a5c14 100644 --- a/Lib/swigrun.swg +++ b/Lib/swigrun.swg @@ -232,18 +232,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, /* Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if not equal, 1 if equal + Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; const char* te = tb + strlen(tb); const char* ne = nb; - while (!equiv && *ne) { + while (equiv != 0 && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + equiv = SWIG_TypeNameComp(nb, ne, tb, te); if (*ne) ++ne; } return equiv; @@ -251,24 +251,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { /* Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb + Return 0 if not equal, 1 if equal */ SWIGRUNTIME int -SWIG_TypeCompare(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } - /* Check the typename */ |