get rid of static buffers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7035 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ce2c0dce05
commit
fbab379cc3
1 changed files with 26 additions and 33 deletions
|
|
@ -159,12 +159,15 @@ String *Swig_string_typecode(String *s) {
|
||||||
ns = NewString("");
|
ns = NewString("");
|
||||||
while ((c = Getc(s)) != EOF) {
|
while ((c = Getc(s)) != EOF) {
|
||||||
if (c == '`') {
|
if (c == '`') {
|
||||||
|
String *str = 0;
|
||||||
tc = NewString("");
|
tc = NewString("");
|
||||||
while ((c = Getc(s)) != EOF) {
|
while ((c = Getc(s)) != EOF) {
|
||||||
if (c == '`') break;
|
if (c == '`') break;
|
||||||
Putc(c,tc);
|
Putc(c,tc);
|
||||||
}
|
}
|
||||||
Printf(ns,"%s",SwigType_str(tc,0));
|
str = SwigType_str(tc,0);
|
||||||
|
Printf(ns,"%s",str);
|
||||||
|
Delete(str);
|
||||||
} else {
|
} else {
|
||||||
Putc(c,ns);
|
Putc(c,ns);
|
||||||
if (c == '\'') {
|
if (c == '\'') {
|
||||||
|
|
@ -357,14 +360,12 @@ String *Swig_string_mangle(const String *s) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Swig_scopename_prefix(String *s) {
|
Swig_scopename_prefix(String *s) {
|
||||||
char tmp[1024];
|
char *tmp = Char(s);
|
||||||
char *c, *cc;
|
char *c = tmp;
|
||||||
if (!Strstr(s,"::")) return 0;
|
char *cc = c;
|
||||||
strcpy(tmp,Char(s));
|
if (!strstr(c,"::")) return 0;
|
||||||
c = tmp;
|
|
||||||
cc = c;
|
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (strncmp(c,"::",2) == 0) {
|
if ((*c == ':') && (*(c+1) == ':')) {
|
||||||
cc = c;
|
cc = c;
|
||||||
c += 2;
|
c += 2;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -382,9 +383,8 @@ Swig_scopename_prefix(String *s) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*cc = 0;
|
|
||||||
if (cc != tmp) {
|
if (cc != tmp) {
|
||||||
return NewString(tmp);
|
return NewStringWithSize(tmp, cc - tmp);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -399,15 +399,13 @@ Swig_scopename_prefix(String *s) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Swig_scopename_last(String *s) {
|
Swig_scopename_last(String *s) {
|
||||||
char tmp[1024];
|
char *tmp = Char(s);
|
||||||
char *c, *cc;
|
char *c = tmp;
|
||||||
if (!Strstr(s,"::")) return NewString(s);
|
char *cc = c;
|
||||||
strcpy(tmp,Char(s));
|
if (!strstr(c,"::")) return NewString(s);
|
||||||
c = tmp;
|
|
||||||
cc = c;
|
|
||||||
|
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (strncmp(c,"::",2) == 0) {
|
if ((*c == ':') && (*(c+1) == ':')) {
|
||||||
cc = c;
|
cc = c;
|
||||||
c += 2;
|
c += 2;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -436,13 +434,11 @@ Swig_scopename_last(String *s) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Swig_scopename_first(String *s) {
|
Swig_scopename_first(String *s) {
|
||||||
char tmp[1024];
|
char *tmp = Char(s);
|
||||||
char *c;
|
char *c = tmp;
|
||||||
if (!Strstr(s,"::")) return 0;
|
if (!strstr(c,"::")) return 0;
|
||||||
strcpy(tmp,Char(s));
|
|
||||||
c = tmp;
|
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (strncmp(c,"::",2) == 0) {
|
if ((*c == ':') && (*(c+1) == ':')) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (*c == '<') {
|
if (*c == '<') {
|
||||||
|
|
@ -459,8 +455,7 @@ Swig_scopename_first(String *s) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*c && (c != tmp)) {
|
if (*c && (c != tmp)) {
|
||||||
*c = 0;
|
return NewStringWithSize(tmp, c - tmp);
|
||||||
return NewString(tmp);
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -476,13 +471,11 @@ Swig_scopename_first(String *s) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Swig_scopename_suffix(String *s) {
|
Swig_scopename_suffix(String *s) {
|
||||||
char tmp[1024];
|
char *tmp = Char(s);
|
||||||
char *c;
|
char *c = tmp;
|
||||||
if (!Strstr(s,"::")) return 0;
|
if (!strstr(c,"::")) return 0;
|
||||||
strcpy(tmp,Char(s));
|
|
||||||
c = tmp;
|
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (strncmp(c,"::",2) == 0) {
|
if ((*c == ':') && (*(c+1) == ':')) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (*c == '<') {
|
if (*c == '<') {
|
||||||
|
|
@ -512,9 +505,9 @@ Swig_scopename_suffix(String *s) {
|
||||||
|
|
||||||
int Swig_scopename_check(String *s) {
|
int Swig_scopename_check(String *s) {
|
||||||
char *c = Char(s);
|
char *c = Char(s);
|
||||||
if (!Strstr(s,"::")) return 0;
|
if (!strstr(c,"::")) return 0;
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (strncmp(c,"::",2) == 0) {
|
if ((*c == ':') && (*(c+1) == ':')) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
if (*c == '<') {
|
if (*c == '<') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue