From db1ec847f989a71b2cb1e0c39194e277613931fd Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Wed, 1 Jun 2016 22:03:27 -0700 Subject: fix lint error in wgettext() Cppcheck was complaining about the `return val.c_str()` at the end of the `wgettext()` function. That would normally a bug since the lifetime of `val` ends when the function returns. In this particular case that's not true because the string is interned in a cache. Nonetheless, rather than suppress the lint warning I decided to modify the API to be more idiomatic. In the process of fixing the aforementioned lint warning I fixed several other lint errors in that module. This required making our copy of `wgetopt()` compatible with the rest of the fish code. Specifically, by removing its local definitions of the "_" macro so it uses the same macro used everywhere else in the fish code. The sooner we kill the use of wide chars the better. --- src/wutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wutil.h') diff --git a/src/wutil.h b/src/wutil.h index 9fc61096..b5c77870 100644 --- a/src/wutil.h +++ b/src/wutil.h @@ -84,7 +84,7 @@ std::wstring wbasename(const std::wstring &path); /// gettext function, wgettext takes care of setting the correct domain, etc. using the textdomain /// and bindtextdomain functions. This should probably be moved out of wgettext, so that wgettext /// will be nothing more than a wrapper around gettext, like all other functions in this file. -const wchar_t *wgettext(const wchar_t *in); +const wcstring &wgettext(const wchar_t *in); /// Wide character version of mkdir. int wmkdir(const wcstring &dir, int mode); -- cgit v1.2.3