File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
- // Copyright (c) 2020-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2020-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
@@ -101,7 +101,6 @@ FUZZ_TARGET(string)
101
101
(void )TrimString (random_string_1, random_string_2);
102
102
(void )UrlDecode (random_string_1);
103
103
(void )ContainsNoNUL (random_string_1);
104
- (void )_ (random_string_1.c_str ());
105
104
try {
106
105
throw scriptnum_error{random_string_1};
107
106
} catch (const std::runtime_error&) {
Original file line number Diff line number Diff line change 1
- // Copyright (c) 2019-2022 The Bitcoin Core developers
1
+ // Copyright (c) 2019-present The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
@@ -67,13 +67,19 @@ bilingual_str format(const bilingual_str& fmt, const Args&... args)
67
67
/* * Translate a message to the native language of the user. */
68
68
const extern std::function<std::string(const char *)> G_TRANSLATION_FUN;
69
69
70
+ struct ConstevalStringLiteral {
71
+ const char * const lit;
72
+ consteval ConstevalStringLiteral (const char * str) : lit{str} {}
73
+ consteval ConstevalStringLiteral (std::nullptr_t ) = delete;
74
+ };
75
+
70
76
/* *
71
77
* Translation function.
72
78
* If no translation function is set, simply return the input.
73
79
*/
74
- inline bilingual_str _ (const char * psz )
80
+ inline bilingual_str _ (ConstevalStringLiteral str )
75
81
{
76
- return bilingual_str{psz , G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz ) : psz };
82
+ return bilingual_str{str. lit , G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(str. lit ) : str. lit };
77
83
}
78
84
79
85
#endif // BITCOIN_UTIL_TRANSLATION_H
You can’t perform that action at this time.
0 commit comments