Commit 26a058a5 authored by Daniel Salzman's avatar Daniel Salzman

contrib: move macros from internal, extract attributes to libknot/attribute.h

parent 467acc5f
......@@ -54,6 +54,7 @@ src/contrib/lmdb/mdb.c
src/contrib/lmdb/midl.c
src/contrib/lmdb/midl.h
src/contrib/lookup.h
src/contrib/macros.h
src/contrib/net.c
src/contrib/net.h
src/contrib/openbsd/strlcat.c
......@@ -356,6 +357,7 @@ src/knot/zone/zonedb.c
src/knot/zone/zonedb.h
src/knot/zone/zonefile.c
src/knot/zone/zonefile.h
src/libknot/attribute.h
src/libknot/binary.c
src/libknot/binary.h
src/libknot/codes.c
......@@ -374,7 +376,6 @@ src/libknot/internal/hhash.c
src/libknot/internal/hhash.h
src/libknot/internal/lists.c
src/libknot/internal/lists.h
src/libknot/internal/macros.h
src/libknot/internal/mempattern.c
src/libknot/internal/mempattern.h
src/libknot/internal/namedb/namedb.h
......
......@@ -29,6 +29,7 @@ nobase_libcontrib_la_HEADERS = \
contrib/endian.h \
contrib/getline.h \
contrib/lookup.h \
contrib/macros.h \
contrib/net.h \
contrib/print.h \
contrib/sockaddr.h \
......@@ -46,6 +47,7 @@ nobase_libcontrib_la_HEADERS = \
# dynamic: libknot headers
libknot_ladir = $(includedir)
nobase_libknot_la_HEADERS = \
libknot/attribute.h \
libknot/binary.h \
libknot/codes.h \
libknot/consts.h \
......@@ -85,7 +87,6 @@ libknot_internal_ladir = $(includedir)
nobase_libknot_internal_la_HEADERS = \
libknot/internal/hhash.h \
libknot/internal/lists.h \
libknot/internal/macros.h \
libknot/internal/mempattern.h \
libknot/internal/namedb/namedb.h \
libknot/internal/namedb/namedb_lmdb.h \
......
......@@ -20,8 +20,8 @@
#include <string.h>
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/dnstap/dnstap.h"
#include "contrib/dnstap/reader.h"
......
......@@ -14,22 +14,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file macros.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
* \file
*
* \brief Common macros.
*
* \addtogroup common_lib
* \addtogroup contrib
* @{
*/
#pragma once
/*! \brief Library visibility macros. */
#define _public_ __attribute__((visibility("default")))
#define _hidden_ __attribute__((visibility("hidden")))
/*! \brief Eliminate compiler warning with unused parameters. */
#define UNUSED(param) (void)(param)
......
......@@ -9,7 +9,7 @@
#pragma once
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
/*
* This is not a normal header file, it's a generator of sorting
......
......@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/ucw/mempool.h"
/** \todo This shouldn't be precalculated, but computed on load. */
......
......@@ -32,7 +32,7 @@
#include "knot/common/log.h"
#include "libknot/libknot.h"
#include "libknot/internal/lists.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/openbsd/strlcpy.h"
/* Single log message buffer length (one line). */
......
......@@ -23,8 +23,8 @@
#include "knot/common/log.h"
#include "knot/server/dthreads.h"
#include "libknot/libknot.h"
#include "libknot/internal/macros.h"
#include "libknot/yparser/yptrafo.h"
#include "contrib/macros.h"
#include "contrib/sockaddr.h"
#include "contrib/string.h"
#include "contrib/wire_ctx.h"
......
......@@ -20,8 +20,8 @@
#include "knot/zone/node.h"
#include "libknot/dname.h"
#include "libknot/internal/lists.h"
#include "libknot/internal/macros.h"
#include "libknot/descriptor.h"
#include "contrib/macros.h"
#include "contrib/string.h"
// Addition constants used for tweaking, mostly malloc overhead
......
......@@ -26,7 +26,6 @@
#endif
#include "dnssec/crypto.h"
#include "libknot/internal/macros.h"
#include "libknot/libknot.h"
#include "knot/common/log.h"
#include "knot/ctl/estimator.h"
......@@ -35,6 +34,7 @@
#include "knot/server/tcp-handler.h"
#include "knot/zone/zonefile.h"
#include "knot/zone/zone-load.h"
#include "contrib/macros.h"
#include "contrib/net.h"
#include "contrib/sockaddr.h"
#include "contrib/string.h"
......
......@@ -29,8 +29,8 @@
#include "knot/server/tcp-handler.h"
#include "knot/zone/timers.h"
#include "libknot/libknot.h"
#include "libknot/internal/macros.h"
#include "libknot/yparser/yptrafo.h"
#include "contrib/macros.h"
#include "contrib/net.h"
#include "contrib/sockaddr.h"
#include "contrib/string.h"
......
......@@ -17,7 +17,6 @@
#include <assert.h>
#include "dnssec/nsec.h"
#include "libknot/internal/macros.h"
#include "knot/dnssec/nsec3-chain.h"
#include "libknot/dname.h"
#include "libknot/packet/wire.h"
......@@ -28,6 +27,7 @@
#include "knot/dnssec/zone-sign.h"
#include "knot/dnssec/zone-nsec.h"
#include "contrib/base32hex.h"
#include "contrib/macros.h"
#include "contrib/wire_ctx.h"
/* - NSEC3 node comparison -------------------------------------------------- */
......
......@@ -19,7 +19,7 @@
#include "dnssec/error.h"
#include "dnssec/event.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/string.h"
#include "libknot/libknot.h"
#include "knot/conf/conf.h"
......
......@@ -32,10 +32,10 @@
#include "libknot/dname.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/libknot.h"
#include "libknot/internal/macros.h"
#include "libknot/rrset.h"
#include "libknot/rrtype/rrsig.h"
#include "libknot/rrtype/soa.h"
#include "contrib/macros.h"
typedef struct type_node {
node_t n;
......
......@@ -17,8 +17,8 @@
#include "knot/conf/conf.h"
#include "knot/common/log.h"
#include "libknot/libknot.h"
#include "libknot/internal/macros.h"
#include "libknot/yparser/yptrafo.h"
#include "contrib/macros.h"
#include "contrib/sockaddr.h"
/*! \brief Accessor to query-specific data. */
......
......@@ -23,7 +23,6 @@
#include "knot/updates/apply.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/common/log.h"
#include "libknot/internal/macros.h"
#include "knot/dnssec/zone-events.h"
#include "knot/updates/ddns.h"
#include "knot/updates/zone-update.h"
......@@ -36,6 +35,7 @@
#include "knot/server/udp-handler.h"
#include "knot/nameserver/capture.h"
#include "libknot/processing/requestor.h"
#include "contrib/macros.h"
#include "contrib/net.h"
#include "contrib/print.h"
#include "contrib/sockaddr.h"
......
......@@ -38,8 +38,8 @@
#include "knot/common/log.h"
#include "knot/common/time.h"
#include "knot/nameserver/process_query.h"
#include "libknot/internal/macros.h"
#include "libknot/processing/overlay.h"
#include "contrib/macros.h"
#include "contrib/net.h"
#include "contrib/sockaddr.h"
#include "contrib/ucw/mempool.h"
......
......@@ -38,9 +38,9 @@
#include "knot/server/udp-handler.h"
#include "knot/server/server.h"
#include "libknot/internal/mempattern.h"
#include "libknot/internal/macros.h"
#include "libknot/libknot.h"
#include "libknot/processing/overlay.h"
#include "contrib/macros.h"
#include "contrib/sockaddr.h"
#include "contrib/ucw/mempool.h"
......
......@@ -23,7 +23,7 @@
#include "knot/common/log.h"
#include "libknot/libknot.h"
#include "libknot/internal/lists.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
/* --------------------------- Update cleanup ------------------------------- */
......
......@@ -20,7 +20,7 @@
#include "knot/updates/changesets.h"
#include "libknot/rrset.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
/* -------------------- Changeset iterator helpers -------------------------- */
......
......@@ -21,7 +21,7 @@
#include "knot/dnssec/zone-nsec.h"
#include "libknot/libknot.h"
#include "libknot/internal/trie/hat-trie.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
typedef struct {
zone_contents_apply_cb_t func;
......
......@@ -20,7 +20,7 @@
#include "knot/zone/events/handlers.h"
#include "knot/zone/zone.h"
#include "libknot/rrtype/soa.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
/* -- Zone event replanning functions --------------------------------------- */
......
......@@ -22,7 +22,7 @@
#include "knot/zone/node.h"
#include "libknot/consts.h"
#include "libknot/internal/trie/hat-trie.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
/*----------------------------------------------------------------------------*/
/* API functions */
......
......@@ -27,7 +27,7 @@
#include "libknot/packet/wire.h"
#include "knot/zone/node.h"
#include "libknot/internal/mempattern.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/ucw/mempool.h"
/*----------------------------------------------------------------------------*/
......
......@@ -26,7 +26,7 @@
#include <inttypes.h>
#include "libknot/libknot.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/string.h"
#include "knot/common/log.h"
#include "knot/dnssec/zone-nsec.h"
......
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file
*
* \brief Function attributes.
*
* \addtogroup libknot
* @{
*/
#pragma once
/*! \brief Library visibility macros. */
#define _public_ __attribute__((visibility("default")))
#define _hidden_ __attribute__((visibility("hidden")))
/*! @} */
......@@ -17,9 +17,9 @@
#include <stdlib.h>
#include <string.h>
#include "libknot/attribute.h"
#include "libknot/binary.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "contrib/base64.h"
#include "contrib/string.h"
......
......@@ -14,10 +14,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/attribute.h"
#include "libknot/codes.h"
#include "libknot/consts.h"
#include "contrib/lookup.h"
#include "libknot/internal/macros.h"
const lookup_table_t opcode_names[] = {
{ KNOT_OPCODE_QUERY, "QUERY" },
......
......@@ -18,8 +18,8 @@
#include <stdlib.h>
#include <strings.h>
#include "libknot/attribute.h"
#include "libknot/descriptor.h"
#include "libknot/internal/macros.h"
/*!
* \brief Table with DNS classes.
......
......@@ -21,11 +21,11 @@
#include <string.h>
#include <inttypes.h>
#include "libknot/attribute.h"
#include "libknot/consts.h"
#include "libknot/dname.h"
#include "libknot/errcode.h"
#include "libknot/packet/wire.h"
#include "libknot/internal/macros.h"
#include "libknot/internal/mempattern.h"
#include "contrib/tolower.h"
......
......@@ -23,9 +23,9 @@
#include "dnssec/kasp.h"
#include "dnssec/key.h"
#include "dnssec/sign.h"
#include "libknot/attribute.h"
#include "libknot/descriptor.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/internal/macros.h"
#include "libknot/libknot.h"
#include "libknot/packet/rrset-wire.h"
#include "libknot/packet/rrset-wire.h"
......
......@@ -19,8 +19,8 @@
#include <lmdb.h>
#endif
#include "libknot/attribute.h"
#include "libknot/error.h"
#include "libknot/internal/macros.h"
#include "dnssec/error.h"
struct error {
......
......@@ -2,7 +2,7 @@
#include <assert.h>
#include <stdbool.h>
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "libknot/internal/hhash.h"
#include "libknot/internal/trie/murmurhash3.h"
#include "libknot/errcode.h"
......
......@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <string.h>
#include "libknot/internal/macros.h"
#include "libknot/internal/lists.h"
/**
......
......@@ -16,7 +16,6 @@
#include <stdlib.h>
#include "libknot/internal/macros.h"
#include "libknot/internal/mempattern.h"
#include "contrib/ucw/mempool.h"
......
......@@ -21,7 +21,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include "libknot/internal/macros.h"
#include "libknot/internal/namedb/namedb_lmdb.h"
#include "libknot/errcode.h"
......
......@@ -16,7 +16,6 @@
#include <assert.h>
#include "libknot/internal/macros.h"
#include "libknot/errcode.h"
#include "libknot/internal/namedb/namedb_trie.h"
#include "libknot/internal/trie/hat-trie.h"
......
......@@ -8,7 +8,6 @@
#include <stdint.h>
#include <assert.h>
#include <string.h>
#include "libknot/internal/macros.h"
#include "libknot/internal/trie/hat-trie.h"
#include "libknot/internal/hhash.h"
......
/* This is MurmurHash3. The original C++ code was placed in the public domain
* by its author, Austin Appleby. */
#include "libknot/internal/macros.h"
#include "libknot/internal/trie/murmurhash3.h"
static inline uint32_t fmix(uint32_t h)
......
......@@ -16,10 +16,10 @@
#include <assert.h>
#include "libknot/attribute.h"
#include "libknot/packet/compr.h"
#include "libknot/errcode.h"
#include "libknot/packet/pkt.h"
#include "libknot/internal/macros.h"
#include "contrib/tolower.h"
/*! \brief Case insensitive label compare for compression. */
......
......@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include "libknot/attribute.h"
#include "libknot/packet/pkt.h"
#include "libknot/descriptor.h"
#include "libknot/errcode.h"
......@@ -25,7 +26,6 @@
#include "libknot/tsig-op.h"
#include "libknot/packet/wire.h"
#include "libknot/packet/rrset-wire.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
#include "contrib/wire_ctx.h"
......
......@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "libknot/attribute.h"
#include "libknot/packet/rrset-wire.h"
#include "libknot/consts.h"
#include "libknot/descriptor.h"
......@@ -29,7 +30,7 @@
#include "libknot/packet/wire.h"
#include "libknot/rrset.h"
#include "libknot/rrtype/naptr.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/wire.h"
#include "contrib/wire_ctx.h"
......
......@@ -16,7 +16,7 @@
#include <assert.h>
#include "libknot/internal/macros.h"
#include "libknot/attribute.h"
#include "libknot/packet/wire.h"
#include "contrib/wire.h"
......
......@@ -16,8 +16,8 @@
#include <assert.h>
#include "libknot/attribute.h"
#include "libknot/processing/layer.h"
#include "libknot/internal/macros.h"
/*! \brief Helper for conditional layer call. */
#define LAYER_CALL(layer, func, ...) \
......
......@@ -14,10 +14,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/attribute.h"
#include "libknot/processing/overlay.h"
#include "libknot/errcode.h"
#include "libknot/internal/lists.h"
#include "libknot/internal/macros.h"
#define LAYERS ((list_t *)overlay->layers)
......
......@@ -16,10 +16,10 @@
#include <assert.h>
#include "libknot/attribute.h"
#include "libknot/processing/requestor.h"
#include "libknot/errcode.h"
#include "libknot/internal/lists.h"
#include "libknot/internal/macros.h"
#include "contrib/net.h"
#include "contrib/sockaddr.h"
......
......@@ -19,9 +19,10 @@
#include <stdio.h>
#include <stdlib.h>
#include "libknot/attribute.h"
#include "libknot/rdata.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#ifndef STRICT_ALIGNMENT
#pragma pack(push, 1)
......
......@@ -19,9 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "libknot/attribute.h"
#include "libknot/rdataset.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
static knot_rdata_t *rr_seek(knot_rdata_t *d, size_t pos)
{
......
......@@ -27,12 +27,12 @@
#include "dnssec/binary.h"
#include "dnssec/keytag.h"
#include "libknot/attribute.h"
#include "libknot/rrset-dump.h"
#include "libknot/codes.h"
#include "libknot/consts.h"
#include "libknot/descriptor.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "contrib/base32hex.h"
#include "contrib/base64.h"
#include "contrib/lookup.h"
......
......@@ -18,11 +18,11 @@
#include <stdbool.h>
#include <stdint.h>
#include "libknot/attribute.h"
#include "libknot/consts.h"
#include "libknot/descriptor.h"
#include "libknot/dname.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "libknot/internal/mempattern.h"
#include "libknot/rrset.h"
#include "libknot/rrtype/naptr.h"
......
......@@ -14,8 +14,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/attribute.h"
#include "libknot/rrtype/dnskey.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
_public_
......
......@@ -17,7 +17,7 @@
#include <assert.h>
#include <stdint.h>
#include "libknot/internal/macros.h"
#include "libknot/attribute.h"
#include "libknot/rrtype/naptr.h"
#include "contrib/wire_ctx.h"
......
......@@ -16,8 +16,8 @@
#include <assert.h>
#include "libknot/attribute.h"
#include "libknot/rrtype/nsec3.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
_public_
......
......@@ -14,9 +14,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/attribute.h"
#include "libknot/rrtype/nsec3param.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "contrib/string.h"
#include "contrib/wire.h"
......
......@@ -20,10 +20,10 @@
#include <string.h>
#include <sys/socket.h>
#include "libknot/attribute.h"
#include "libknot/consts.h"
#include "libknot/rrtype/opt.h"
#include "libknot/descriptor.h"
#include "libknot/internal/macros.h"
#include "contrib/wire_ctx.h"
/*! \brief Some implementation-related constants. */
......
......@@ -14,8 +14,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/attribute.h"
#include "libknot/rrtype/rrsig.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
_public_
......
......@@ -14,8 +14,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/attribute.h"
#include "libknot/rrtype/soa.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
_public_
......
......@@ -22,12 +22,12 @@
#include <time.h>
#include "dnssec/tsig.h"
#include "libknot/attribute.h"
#include "libknot/rrtype/tsig.h"
#include "libknot/consts.h"
#include "libknot/dname.h"
#include "libknot/errcode.h"
#include "libknot/rrset.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
#include "contrib/wire_ctx.h"
......
......@@ -21,6 +21,7 @@
#include "dnssec/error.h"
#include "dnssec/tsig.h"
#include "libknot/attribute.h"
#include "libknot/tsig-op.h"
#include "libknot/errcode.h"
#include "libknot/descriptor.h"
......@@ -32,7 +33,6 @@
#include "libknot/rrtype/tsig.h"
#include "libknot/tsig-op.h"
#include "libknot/packet/rrset-wire.h"
#include "libknot/internal/macros.h"
#include "contrib/wire.h"
const int KNOT_TSIG_MAX_DIGEST_SIZE = 64; // size of HMAC-SHA512 digest
......
......@@ -20,8 +20,8 @@
#include "contrib/getline.h"
#include "contrib/string.h"
#include "dnssec/error.h"
#include "libknot/attribute.h"
#include "libknot/errcode.h"
#include "libknot/internal/macros.h"
#include "libknot/tsig.h"
_public_
......
......@@ -32,7 +32,7 @@
#include "utils/common/sign.h"
#include "utils/common/token.h"
#include "libknot/libknot.h"
#include "libknot/internal/macros.h"
#include "contrib/macros.h"
#include "contrib/lookup.h"
#include "contrib/string.h"
#include "contrib/openbsd/strlcpy.h"
......
......@@ -19,7 +19,7 @@
#include <tap/basic.h>
#include "libknot/internal/trie/hat-trie.h"
#include "libknot/internal/macros.h"