From 6592e9d64ec9b157cfe8ced3f4633f588997fdb8 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Thu, 20 Feb 2003 19:46:35 +0000 Subject: [PATCH] Refinement of noquote string replace to fix [ 605162 ] Typemap local variables. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4366 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DOH/string.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Source/DOH/string.c b/Source/DOH/string.c index c56da26bb..f0c73213a 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -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;