Skip to content

Commit ca424e2

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#22200: zmq: use std::string in zmqError()
3f05a9e zmq: use msg: prefix over errno= in zmqError (fanquake) 9a7cb57 zmq: use std::string in zmqError() (fanquake) Pull request description: This is two minor changes. The first is to change `zmqError` to take a `const std::string&` instead of a `const char*`. The second is to change the second portion of `zmqError` to print `msg: message` rather than `errno=message`, given that `zmq_strerror` returns a message. To me, this seems more readable / useful than output like: `Error: Unable to initialize context errno=No such file or directory`. ACKs for top commit: practicalswift: cr ACK 3f05a9e instagibbs: utACK bitcoin/bitcoin@3f05a9e theStack: Code-Review ACK 3f05a9e Tree-SHA512: 197cf381e8b3ced271d0e575e0c6d8e5e9ed93c4b284338b17873c5232eaabe64d6c4b66e1aeb5e76befc89e316abae2b28b7fd760f178481d7b9f4e3f85da67
2 parents 93e38d5 + 3f05a9e commit ca424e2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/zmq/zmqutil.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
#include <zmq/zmqutil.h>
66

77
#include <logging.h>
8-
98
#include <zmq.h>
109

11-
void zmqError(const char* str)
10+
#include <cerrno>
11+
#include <string>
12+
13+
void zmqError(const std::string& str)
1214
{
13-
LogPrint(BCLog::ZMQ, "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
15+
LogPrint(BCLog::ZMQ, "zmq: Error: %s, msg: %s\n", str, zmq_strerror(errno));
1416
}

src/zmq/zmqutil.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef BITCOIN_ZMQ_ZMQUTIL_H
66
#define BITCOIN_ZMQ_ZMQUTIL_H
77

8-
void zmqError(const char* str);
8+
#include <string>
9+
10+
void zmqError(const std::string& str);
911

1012
#endif // BITCOIN_ZMQ_ZMQUTIL_H

0 commit comments

Comments
 (0)