Problem: Private/internal macros defined in public header.

Solution: Move the macros to a private header.
This commit is contained in:
Joe Eli McIlvain 2015-08-21 16:12:22 -07:00
parent 735c02ed5e
commit 33419425eb
31 changed files with 41 additions and 13 deletions

View File

@ -511,19 +511,6 @@ ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg);
ZMQ_EXPORT void zmq_threadclose (void* thread); ZMQ_EXPORT void zmq_threadclose (void* thread);
/******************************************************************************/
/* 0MQ Internal Use */
/******************************************************************************/
#define LIBZMQ_UNUSED(object) (void)object
#define LIBZMQ_DELETE(p_object) {\
delete p_object; \
p_object = 0; \
}
/******************************************************************************/
#undef ZMQ_EXPORT #undef ZMQ_EXPORT
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#include "address.hpp" #include "address.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "client.hpp" #include "client.hpp"
#include "err.hpp" #include "err.hpp"
#include "msg.hpp" #include "msg.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "dealer.hpp" #include "dealer.hpp"
#include "err.hpp" #include "err.hpp"
#include "msg.hpp" #include "msg.hpp"

View File

@ -37,6 +37,7 @@
#include <algorithm> #include <algorithm>
#include <new> #include <new>
#include "macros.hpp"
#include "epoll.hpp" #include "epoll.hpp"
#include "err.hpp" #include "err.hpp"
#include "config.hpp" #include "config.hpp"

View File

@ -29,6 +29,7 @@
#include <new> #include <new>
#include "macros.hpp"
#include "io_thread.hpp" #include "io_thread.hpp"
#include "platform.hpp" #include "platform.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -38,6 +38,7 @@
#include <algorithm> #include <algorithm>
#include <new> #include <new>
#include "macros.hpp"
#include "kqueue.hpp" #include "kqueue.hpp"
#include "err.hpp" #include "err.hpp"
#include "config.hpp" #include "config.hpp"

12
src/macros.hpp Normal file
View File

@ -0,0 +1,12 @@
/******************************************************************************/
/* 0MQ Internal Use */
/******************************************************************************/
#define LIBZMQ_UNUSED(object) (void)object
#define LIBZMQ_DELETE(p_object) {\
delete p_object; \
p_object = 0; \
}
/******************************************************************************/

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "msg.hpp" #include "msg.hpp"
#include "../include/zmq.h" #include "../include/zmq.h"

View File

@ -32,6 +32,7 @@
#include <new> #include <new>
#include <algorithm> #include <algorithm>
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "pair.hpp" #include "pair.hpp"
#include "err.hpp" #include "err.hpp"
#include "pipe.hpp" #include "pipe.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_OPENPGM #if defined ZMQ_HAVE_OPENPGM

View File

@ -30,6 +30,7 @@
#include <new> #include <new>
#include <stddef.h> #include <stddef.h>
#include "macros.hpp"
#include "pipe.hpp" #include "pipe.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "pull.hpp" #include "pull.hpp"
#include "err.hpp" #include "err.hpp"
#include "msg.hpp" #include "msg.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "push.hpp" #include "push.hpp"
#include "pipe.hpp" #include "pipe.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "reaper.hpp" #include "reaper.hpp"
#include "socket_base.hpp" #include "socket_base.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "router.hpp" #include "router.hpp"
#include "pipe.hpp" #include "pipe.hpp"
#include "wire.hpp" #include "wire.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "server.hpp" #include "server.hpp"
#include "pipe.hpp" #include "pipe.hpp"
#include "wire.hpp" #include "wire.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "session_base.hpp" #include "session_base.hpp"
#include "i_engine.hpp" #include "i_engine.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -31,6 +31,7 @@
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS

View File

@ -30,6 +30,7 @@
#include <new> #include <new>
#include <string> #include <string>
#include "macros.hpp"
#include "socks_connecter.hpp" #include "socks_connecter.hpp"
#include "stream_engine.hpp" #include "stream_engine.hpp"
#include "platform.hpp" #include "platform.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "stream.hpp" #include "stream.hpp"
#include "pipe.hpp" #include "pipe.hpp"
#include "wire.hpp" #include "wire.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "ip.hpp" #include "ip.hpp"
#include "tcp.hpp" #include "tcp.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -30,6 +30,7 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#include "macros.hpp"
#include "tcp_address.hpp" #include "tcp_address.hpp"
#include "platform.hpp" #include "platform.hpp"
#include "stdint.hpp" #include "stdint.hpp"

View File

@ -30,6 +30,7 @@
#include <new> #include <new>
#include <string> #include <string>
#include "macros.hpp"
#include "tcp_connecter.hpp" #include "tcp_connecter.hpp"
#include "stream_engine.hpp" #include "stream_engine.hpp"
#include "io_thread.hpp" #include "io_thread.hpp"

View File

@ -32,6 +32,7 @@
#include <new> #include <new>
#include <algorithm> #include <algorithm>
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp" #include "windows.hpp"

View File

@ -29,6 +29,7 @@
#include <string.h> #include <string.h>
#include "macros.hpp"
#include "xsub.hpp" #include "xsub.hpp"
#include "err.hpp" #include "err.hpp"

View File

@ -28,6 +28,7 @@
*/ */
#define ZMQ_TYPE_UNSAFE #define ZMQ_TYPE_UNSAFE
#include "macros.hpp"
#include "poller.hpp" #include "poller.hpp"
// On AIX platform, poll.h has to be included first to get consistent // On AIX platform, poll.h has to be included first to get consistent

View File

@ -27,6 +27,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "macros.hpp"
#include "platform.hpp" #include "platform.hpp"
#include "clock.hpp" #include "clock.hpp"