Refinement of noquote string replace to fix
[ 605162 ] Typemap local variables. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4366 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ef17d4a002
commit
71748e9622
1 changed files with 16 additions and 0 deletions
|
|
@ -460,11 +460,27 @@ String_ungetc(DOH *so, int ch)
|
|||
static char *
|
||||
end_quote(char *s)
|
||||
{
|
||||
char *qs;
|
||||
char qc;
|
||||
char *q;
|
||||
char *nl;
|
||||
qc = *s;
|
||||
qs = s;
|
||||
while (1) {
|
||||
q = strpbrk(s+1,"\"\'");
|
||||
nl = strchr(s+1,'\n');
|
||||
if (nl && (nl < q)) {
|
||||
/* A new line appears before the end of the string */
|
||||
if (*(nl-1) == '\\') {
|
||||
s = nl+1;
|
||||
continue;
|
||||
}
|
||||
/* String was terminated by a newline. Wing it */
|
||||
return qs;
|
||||
}
|
||||
if (!q && nl) {
|
||||
return qs;
|
||||
}
|
||||
if (!q) return 0;
|
||||
if ((*q == qc) && (*(q-1) != '\\')) return q;
|
||||
s = q;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue