Skip to content

Commit 3fee4b8

Browse files
authored
Switch error message strings to constexpr (#1828)
This changes their linkage so that files which include this header will avoid having unnecessary static global constructors.
1 parent 1ca2626 commit 3fee4b8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/WebSocketProtocol.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
namespace uWS {
2929

3030
/* We should not overcomplicate these */
31-
const std::string_view ERR_TOO_BIG_MESSAGE("Received too big message");
32-
const std::string_view ERR_WEBSOCKET_TIMEOUT("WebSocket timed out from inactivity");
33-
const std::string_view ERR_INVALID_TEXT("Received invalid UTF-8");
34-
const std::string_view ERR_TOO_BIG_MESSAGE_INFLATION("Received too big message, or other inflation error");
35-
const std::string_view ERR_INVALID_CLOSE_PAYLOAD("Received invalid close payload");
36-
const std::string_view ERR_PROTOCOL("Received invalid WebSocket frame");
37-
const std::string_view ERR_TCP_FIN("Received TCP FIN before WebSocket close frame");
31+
constexpr std::string_view ERR_TOO_BIG_MESSAGE("Received too big message");
32+
constexpr std::string_view ERR_WEBSOCKET_TIMEOUT("WebSocket timed out from inactivity");
33+
constexpr std::string_view ERR_INVALID_TEXT("Received invalid UTF-8");
34+
constexpr std::string_view ERR_TOO_BIG_MESSAGE_INFLATION("Received too big message, or other inflation error");
35+
constexpr std::string_view ERR_INVALID_CLOSE_PAYLOAD("Received invalid close payload");
36+
constexpr std::string_view ERR_PROTOCOL("Received invalid WebSocket frame");
37+
constexpr std::string_view ERR_TCP_FIN("Received TCP FIN before WebSocket close frame");
3838

3939
enum OpCode : unsigned char {
4040
CONTINUATION = 0,

0 commit comments

Comments
 (0)