Alter SwigType_parmlist to return an empty list if there are no parameters, rather than a list of one empty type
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10249 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1094fcda7b
commit
14d23e5a59
1 changed files with 11 additions and 6 deletions
|
|
@ -255,8 +255,8 @@ List *SwigType_split(const SwigType *t) {
|
||||||
*
|
*
|
||||||
* Splits a comma separated list of parameters into its component parts
|
* Splits a comma separated list of parameters into its component parts
|
||||||
* The input is expected to contain the parameter list within () brackets
|
* The input is expected to contain the parameter list within () brackets
|
||||||
* returns 0 if no argument list in the input, ie there are no round brackets ()
|
* Returns 0 if no argument list in the input, ie there are no round brackets ()
|
||||||
* returns a List containing a single empty string if there are no parameters in the () brackets
|
* Returns an empty List if there are no parameters in the () brackets
|
||||||
* For example:
|
* For example:
|
||||||
*
|
*
|
||||||
* Foo(std::string,p.f().Bar<(int,double)>)
|
* Foo(std::string,p.f().Bar<(int,double)>)
|
||||||
|
|
@ -267,10 +267,11 @@ List *SwigType_split(const SwigType *t) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
List *SwigType_parmlist(const String *p) {
|
List *SwigType_parmlist(const String *p) {
|
||||||
String *item;
|
String *item = 0;
|
||||||
List *list;
|
List *list;
|
||||||
char *c;
|
char *c;
|
||||||
char *itemstart;
|
char *itemstart;
|
||||||
|
int size;
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
c = Char(p);
|
c = Char(p);
|
||||||
|
|
@ -284,7 +285,8 @@ List *SwigType_parmlist(const String *p) {
|
||||||
itemstart = c;
|
itemstart = c;
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (*c == ',') {
|
if (*c == ',') {
|
||||||
item = NewStringWithSize(itemstart, (int) (c - itemstart));
|
size = (int) (c - itemstart);
|
||||||
|
item = NewStringWithSize(itemstart, size);
|
||||||
Append(list, item);
|
Append(list, item);
|
||||||
Delete(item);
|
Delete(item);
|
||||||
itemstart = c + 1;
|
itemstart = c + 1;
|
||||||
|
|
@ -307,8 +309,11 @@ List *SwigType_parmlist(const String *p) {
|
||||||
if (*c)
|
if (*c)
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
item = NewStringWithSize(itemstart, (int) (c - itemstart));
|
size = (int) (c - itemstart);
|
||||||
Append(list, item);
|
if (size > 0) {
|
||||||
|
item = NewStringWithSize(itemstart, size);
|
||||||
|
Append(list, item);
|
||||||
|
}
|
||||||
Delete(item);
|
Delete(item);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue