Commit 58e2fb42 authored by Daniel Salzman's avatar Daniel Salzman

contrib: move time and trim from knot/common

parent b8abaab8
......@@ -55,7 +55,9 @@ libcontrib_la_SOURCES = \
contrib/sockaddr.h \
contrib/string.c \
contrib/string.h \
contrib/time.h \
contrib/tolower.h \
contrib/trim.h \
contrib/wire.h \
contrib/wire_ctx.h \
contrib/hat-trie/hat-trie.c \
......@@ -293,8 +295,6 @@ libknotd_la_SOURCES = \
knot/common/log.h \
knot/common/ref.c \
knot/common/ref.h \
knot/common/time.h \
knot/common/trim.h \
knot/server/dthreads.c \
knot/server/dthreads.h \
knot/server/journal.c \
......
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2015 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
......@@ -14,13 +14,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file time.h
*
* \author Lubos Slovak <lubos.slovak@nic.cz>
* \file
*
* \brief Universal time getter.
*
* \addtogroup server
* \addtogroup contrib
* @{
*/
......
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2015 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
......@@ -13,6 +13,14 @@
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 Heap memory trimmer.
*
* \addtogroup contrib
* @{
*/
#pragma once
......@@ -28,5 +36,7 @@ static inline void mem_trim(void)
#ifdef HAVE_MALLOC_TRIM
malloc_trim(0);
#endif
return;
}
/*! @} */
......@@ -19,19 +19,8 @@
#include <unistd.h>
#include <time.h>
#include "knot/common/fdset.h"
#include "libknot/libknot.h"
/* Workarounds for clock_gettime() not available on some platforms. */
#ifdef HAVE_CLOCK_GETTIME
#define time_now(x) clock_gettime(CLOCK_MONOTONIC, (x))
typedef struct timespec timev_t;
#elif HAVE_GETTIMEOFDAY
#include <sys/time.h>
#define time_now(x) gettimeofday((x), NULL)
typedef struct timeval timev_t;
#else
#error Neither clock_gettime() nor gettimeofday() found. At least one is required.
#endif
#include "contrib/time.h"
#include "libknot/errcode.h"
/* Realloc memory or return error (part of fdset_resize). */
#define MEM_RESIZE(tmp, p, n) \
......
......@@ -25,7 +25,6 @@
#include "libknot/errcode.h"
#include "knot/common/log.h"
#include "knot/common/trim.h"
#include "knot/server/server.h"
#include "knot/server/udp-handler.h"
#include "knot/server/tcp-handler.h"
......@@ -35,6 +34,7 @@
#include "knot/zone/zonedb-load.h"
#include "contrib/net.h"
#include "contrib/sockaddr.h"
#include "contrib/trim.h"
/*! \brief Minimal send/receive buffer sizes. */
enum {
......
......@@ -36,12 +36,12 @@
#include "knot/server/tcp-handler.h"
#include "knot/common/fdset.h"
#include "knot/common/log.h"
#include "knot/common/time.h"
#include "knot/nameserver/process_query.h"
#include "libknot/processing/overlay.h"
#include "contrib/macros.h"
#include "contrib/net.h"
#include "contrib/sockaddr.h"
#include "contrib/time.h"
#include "contrib/ucw/mempool.h"
/*! \brief TCP context data. */
......
......@@ -20,11 +20,11 @@
#include "libknot/libknot.h"
#include "libknot/processing/requestor.h"
#include "libknot/yparser/yptrafo.h"
#include "contrib/trim.h"
#include "contrib/ucw/mempool.h"
#include "contrib/wire.h"
#include "knot/common/log.h"
#include "knot/common/trim.h"
#include "knot/server/udp-handler.h"
#include "knot/server/tcp-handler.h"
#include "knot/updates/changesets.h"
......
......@@ -23,7 +23,6 @@
#include "dnssec/random.h"
#include "knot/common/evsched.h"
#include "knot/common/log.h"
#include "knot/common/trim.h"
#include "knot/zone/node.h"
#include "knot/zone/serial.h"
#include "knot/zone/zone.h"
......@@ -35,6 +34,7 @@
#include "libknot/libknot.h"
#include "libknot/processing/requestor.h"
#include "contrib/string.h"
#include "contrib/trim.h"
#include "contrib/ucw/lists.h"
#define JOURNAL_SUFFIX ".diff.db"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment