aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-05-17 14:17:01 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-05-17 14:17:01 -0700
commit286c60bc9d1b692b650bd0c37a6da635e99f119f (patch)
tree0afbe223a384e7562e94b306a91d1f89ae724330 /common.cpp
parentc26d317da5950645590fecf45c907f35ba0462bb (diff)
Correctly handle mixing named arguments with function name
Before this fix, `function -a arg1 name1` would produce a function named 'arg1'. After this fix, it will produce a function named 'name'. See #2068 for more.
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/common.cpp b/common.cpp
index 3440f075..6767e351 100644
--- a/common.cpp
+++ b/common.cpp
@@ -481,9 +481,14 @@ const wchar_t *wcsvarname(const wchar_t *str)
return NULL;
}
-const wchar_t *wcsfuncname(const wchar_t *str)
+const wchar_t *wcsvarname(const wcstring &str)
{
- return wcschr(str, L'/');
+ return wcsvarname(str.c_str());
+}
+
+const wchar_t *wcsfuncname(const wcstring &str)
+{
+ return wcschr(str.c_str(), L'/');
}