From d7f06c3721308d35153d58a25052be33da726f89 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 30 Oct 2021 18:51:19 +0200 Subject: [PATCH] Reuse Swig_string_mangle() instead of using Replaceall() Use the same function in getNamespacedName() which was already used in getGlobalWrapperName() just below, this is more readable and more clear than just replacing dots with underscores as we did before. Also use scoped_dohptr instead of manual Delete() calls. No real changes. --- Source/Modules/c.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Modules/c.cxx b/Source/Modules/c.cxx index 2e7931332..9449a9659 100644 --- a/Source/Modules/c.cxx +++ b/Source/Modules/c.cxx @@ -189,10 +189,8 @@ public: String *nspace = Getattr(n, "sym:nspace"); if (nspace) { - String *nspace_mangled = Copy(nspace); - Replaceall(nspace_mangled, ".", "_"); - proxyname = NewStringf("%s_%s", nspace_mangled, symname); - Delete(nspace_mangled); + scoped_dohptr nspace_mangled(Swig_string_mangle(nspace)); + proxyname = NewStringf("%s_%s", (DOH*)nspace_mangled, symname); } else { proxyname = Copy(symname); }