Skip to content

Commit a3ffb6e

Browse files
committed
Replace zmqconfig.h by a simple zmqutil.
zmqconfig.h is currently not really needed anywhere, except that it declares zmqError (which is then defined in zmqnotificationinterface.cpp). Note in particular that there is no need to conditionally include zmq.h only if ZMQ is enabled, because the place in the core code where the ZMQ library itself is included (init.cpp) is conditional already on that. This commit removes zmqconfig.h and replaces it by a much simpler zmqutil.h library for zmqError. The definition of the function is moved to the matching (newly created) zmqutil.cpp.
1 parent 7f2ad1b commit a3ffb6e

File tree

8 files changed

+40
-35
lines changed

8 files changed

+40
-35
lines changed

src/Makefile.am

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ BITCOIN_CORE_H = \
262262
walletinitinterface.h \
263263
warnings.h \
264264
zmq/zmqabstractnotifier.h \
265-
zmq/zmqconfig.h\
266265
zmq/zmqnotificationinterface.h \
267266
zmq/zmqpublishnotifier.h \
268-
zmq/zmqrpc.h
267+
zmq/zmqrpc.h \
268+
zmq/zmqutil.h
269269

270270

271271
obj/build.h: FORCE
@@ -344,7 +344,8 @@ libbitcoin_zmq_a_SOURCES = \
344344
zmq/zmqabstractnotifier.cpp \
345345
zmq/zmqnotificationinterface.cpp \
346346
zmq/zmqpublishnotifier.cpp \
347-
zmq/zmqrpc.cpp
347+
zmq/zmqrpc.cpp \
348+
zmq/zmqutil.cpp
348349
endif
349350

350351

src/zmq/zmqabstractnotifier.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include <zmq/zmqabstractnotifier.h>
66

7+
#include <cassert>
8+
79
const int CZMQAbstractNotifier::DEFAULT_ZMQ_SNDHWM;
810

911
CZMQAbstractNotifier::~CZMQAbstractNotifier()

src/zmq/zmqabstractnotifier.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#ifndef BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
66
#define BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
77

8-
#include <zmq/zmqconfig.h>
9-
108
#include <util/memory.h>
119

1210
#include <memory>
11+
#include <string>
1312

1413
class CBlockIndex;
14+
class CTransaction;
1515
class CZMQAbstractNotifier;
1616

1717
using CZMQNotifierFactory = std::unique_ptr<CZMQAbstractNotifier> (*)();

src/zmq/zmqconfig.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/zmq/zmqnotificationinterface.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
#include <zmq/zmqnotificationinterface.h>
66
#include <zmq/zmqpublishnotifier.h>
7+
#include <zmq/zmqutil.h>
8+
9+
#include <zmq.h>
710

811
#include <validation.h>
912
#include <util/system.h>
1013

11-
void zmqError(const char *str)
12-
{
13-
LogPrint(BCLog::ZMQ, "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
14-
}
15-
1614
CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(nullptr)
1715
{
1816
}

src/zmq/zmqpublishnotifier.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <zmq/zmqpublishnotifier.h>
6+
57
#include <chain.h>
68
#include <chainparams.h>
9+
#include <rpc/server.h>
710
#include <streams.h>
8-
#include <zmq/zmqpublishnotifier.h>
9-
#include <validation.h>
1011
#include <util/system.h>
11-
#include <rpc/server.h>
12+
#include <validation.h>
13+
#include <zmq/zmqutil.h>
1214

1315
#include <zmq.h>
1416

src/zmq/zmqutil.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2014-2018 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <zmq/zmqutil.h>
6+
7+
#include <logging.h>
8+
9+
#include <zmq.h>
10+
11+
void zmqError(const char* str)
12+
{
13+
LogPrint(BCLog::ZMQ, "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
14+
}

src/zmq/zmqutil.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) 2014-2018 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_ZMQ_ZMQUTIL_H
6+
#define BITCOIN_ZMQ_ZMQUTIL_H
7+
8+
void zmqError(const char* str);
9+
10+
#endif // BITCOIN_ZMQ_ZMQUTIL_H

0 commit comments

Comments
 (0)