From ccaeb3123125949b9b78528f029e5cea0cb384a3 Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Mon, 29 Jan 2024 23:01:50 +0100 Subject: [PATCH] Only call once escape_bracket --- src/nrnoc/cabcode.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/nrnoc/cabcode.cpp b/src/nrnoc/cabcode.cpp index a9794b94ae..5fdc65fd56 100644 --- a/src/nrnoc/cabcode.cpp +++ b/src/nrnoc/cabcode.cpp @@ -1998,11 +1998,11 @@ void forall_section(void) { s = hoc_strpop(); buf[0] = '\0'; if (s) { - Sprintf(buf, "%s.*%s.*", escape_bracket(objectname()), escape_bracket(*s)); + Sprintf(buf, "%s.*%s.*", objectname(), *s); } else { char* o = objectname(); if (o[0]) { - Sprintf(buf, "%s.*", escape_bracket(o)); + Sprintf(buf, "%s.*", o); } } istk = nrn_isecstack(); @@ -2011,8 +2011,7 @@ void forall_section(void) { Section* sec = hocSEC(qsec); qsec = qsec->next; if (buf[0]) { - std::cout << "forall_section: " << buf << " : " << secname(sec) << std::endl; - std::regex pattern(buf); + std::regex pattern(escape_bracket(buf)); if (!std::regex_match(secname(sec), pattern)) { continue; } @@ -2043,9 +2042,8 @@ void hoc_ifsec(void) { extern int hoc_returning; s = hoc_strpop(); - Sprintf(buf, ".*%s.*", escape_bracket(*s)); - std::regex pattern(buf); - std::cout << "hoc_ifsec: " << buf << " : " << secname(chk_access()) << std::endl; + Sprintf(buf, ".*%s.*", *s); + std::regex pattern(escape_bracket(buf)); if (std::regex_match(secname(chk_access()), pattern)) { hoc_execute(relative(savepc)); } @@ -2055,7 +2053,6 @@ void hoc_ifsec(void) { void issection(void) { /* returns true if string is the access section */ std::regex pattern(escape_bracket(gargstr(1))); - std::cout << "hoc_ifsec: " << escape_bracket(gargstr(1)) << " : " << secname(chk_access()) << std::endl; if (std::regex_match(secname(chk_access()), pattern)) { hoc_retpushx(1.); } else {