From e861f336b3e0b57c7e8e1e5f68c34626614cd890 Mon Sep 17 00:00:00 2001 From: stefanjones Date: Tue, 8 Jul 2003 14:46:09 +0000 Subject: [PATCH] Modified Files: Tag: TCLSPICE src/frontend/ChangeLog src/frontend/quote.c fix returned pointer --- src/frontend/ChangeLog | 3 +++ src/frontend/quote.c | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/frontend/ChangeLog b/src/frontend/ChangeLog index e86093135..3080a1f65 100644 --- a/src/frontend/ChangeLog +++ b/src/frontend/ChangeLog @@ -1,3 +1,6 @@ +2003-07-08 Stefan Jones + * quote.c: return the pointer to the start of malloced + memory so it can be freeded 2003-05-02 Stuart Brorson * Major changes in subckt.c to handle POLY attributes in dependent sources. Added new case to switch in "translate" to diff --git a/src/frontend/quote.c b/src/frontend/quote.c index e4d8641af..38bba2d63 100644 --- a/src/frontend/quote.c +++ b/src/frontend/quote.c @@ -78,14 +78,15 @@ cp_unquote(char *string) char *s; int l; if (string) { - s = copy(string); + l = strlen(string); + s = MALLOC(l+1); - if (*s == '"') - s++; + if (*string == '"' && string[l-1] == '"') { + strncpy(s,string+1,l-2); + s[l-2] = '\0'; + } else + strcpy(s,string); - l = strlen(s) - 1; - if (s[l] == '"') - s[l] = '\0'; return (s); } else return 0;