Commit 9b488b3f authored by Jan Včelák's avatar Jan Včelák 🚀

src: remove trailing whitespaces

parent b09daa23
......@@ -33,7 +33,6 @@ static inline void json_decref_ptr(json_t **json_ptr)
#define _json_cleanup_ _cleanup_(json_decref_ptr)
/*! Options for JSON reading. */
#define JSON_LOAD_OPTIONS JSON_REJECT_DUPLICATES
......
......@@ -27,7 +27,6 @@
#include "pem.h"
#include "shared.h"
static int pem_to_x509(const dnssec_binary_t *data, gnutls_x509_privkey_t *key_ptr)
{
assert(data);
......
......@@ -55,7 +55,6 @@ int pem_generate(gnutls_pk_algorithm_t algorithm, unsigned bits,
*/
int pem_gnutls_x509_export(gnutls_x509_privkey_t key, dnssec_binary_t *pem);
/*!
* Get key ID of a private key in PEM format.
*
......
......@@ -65,7 +65,6 @@ int check_random_type(void)
return conflicts <= 50 ? 0 : 1;
}
int main(void)
{
plan_lazy();
......
......@@ -84,7 +84,6 @@ int value_bool(int argc, char *argv[], const parameter_t *p, void *data)
return -1;
}
int value_string(int argc, char *argv[], const parameter_t *p, void *data)
{
assert(p);
......
......@@ -152,7 +152,6 @@ static void print_key(const dnssec_key_t *key)
printf("id %s keytag %d\n", dnssec_key_get_id(key), dnssec_key_get_keytag(key));
}
/* -- actions implementation ----------------------------------------------- */
/*
......
......@@ -101,7 +101,6 @@ static void ecdsa_extract_public_params(dnssec_key_t *key, gnutls_ecc_curve_t *c
y->size = param_size;
}
static int ecdsa_params_to_pem(dnssec_key_t *dnskey, const legacy_privkey_t *params,
dnssec_binary_t *pem)
{
......
......@@ -38,12 +38,12 @@
*
* \note This function returns a copy of its parameter return value 'buf' to
* make error checking slightly easier.
*
*
* \param d dnstap protobuf struct.
* \param[out] buf Serialized frame.
* \param[out] sz Size in bytes of the serialized frame.
*
* \return Serialized frame.
*
* \return Serialized frame.
* \retval NULL if error.
*/
uint8_t* dt_pack(const Dnstap__Dnstap *d, uint8_t **buf, size_t *sz);
......
......@@ -31,7 +31,7 @@ dt_reader_t* dt_reader_create(const char *file_path)
struct fstrm_reader_options *ropt = NULL;
dt_reader_t *reader = NULL;
fstrm_res res;
reader = calloc(1, sizeof(dt_reader_t));
if (reader == NULL) {
goto fail;
......
......@@ -30,7 +30,7 @@ dt_writer_t* dt_writer_create(const char *file_path, const char *version)
struct fstrm_writer_options *wopt = NULL;
dt_writer_t *writer = NULL;
fstrm_res res;
writer = calloc(1, sizeof(dt_writer_t));
if (writer == NULL) {
goto fail;
......
......@@ -164,15 +164,15 @@ static int evsched_try_cancel(evsched_t *sched, event_t *ev)
if (sched == NULL || ev == NULL) {
return KNOT_EINVAL;
}
/* Make sure not running. If an event is starting, we race for this lock
* and either win or lose. If we lose, we may find it in heap because
* it rescheduled itself. Either way, it will be marked as last running. */
pthread_mutex_lock(&sched->run_lock);
/* Lock calendar. */
pthread_mutex_lock(&sched->heap_lock);
if ((found = heap_find(&sched->heap, ev))) {
heap_delete(&sched->heap, found);
}
......@@ -186,7 +186,7 @@ static int evsched_try_cancel(evsched_t *sched, event_t *ev)
/* Unlock calendar. */
pthread_cond_broadcast(&sched->notify);
pthread_mutex_unlock(&sched->heap_lock);
/* Enable running events. */
pthread_mutex_unlock(&sched->run_lock);
......
......@@ -904,7 +904,6 @@ int conf_bg_threads(const conf_t *conf)
return conf->bg_workers;
}
void conf_init_zone(conf_zone_t *zone)
{
if (!zone) {
......
......@@ -21,7 +21,6 @@
#include "knot/conf/includes.h"
#include "knot/conf/extra.h"
/*!
* \brief Init structure with custom data for config parser.
*/
......
......@@ -180,4 +180,3 @@ int estimator_free_trie_node(value_t *val, void *data)
return KNOT_EOK;
}
......@@ -93,7 +93,6 @@ int pid_running(pid_t pid);
*/
int proc_update_privileges(int uid, int gid);
/*!
* \brief Check if PID file exists and create it if possible.
* \retval NULL if failed
......
......@@ -336,7 +336,6 @@ const zone_key_t *get_zone_key(const zone_keyset_t *keyset, uint16_t search)
return NULL;
}
/*!
* \brief Get timestamp of next key event.
*/
......
......@@ -154,7 +154,7 @@ static int mark_removed_nsec3(changeset_t *out_ch,
changeset_iter_t itt;
changeset_iter_rem(&itt, out_ch, false);
knot_rrset_t rr = changeset_iter_next(&itt);
while (!knot_rrset_empty(&rr)) {
int ret = mark_nsec3(&rr, zone->nsec3_nodes);
......@@ -165,7 +165,7 @@ static int mark_removed_nsec3(changeset_t *out_ch,
rr = changeset_iter_next(&itt);
}
changeset_iter_clear(&itt);
return KNOT_EOK;
}
......
......@@ -296,7 +296,6 @@ int main(int argc, char **argv)
log_info("configured %zu interfaces and %zu zones",
list_size(&config->ifaces), hattrie_weight(config->zones));
/* Alter privileges. */
log_update_privileges(config->uid, config->gid);
if (proc_update_privileges(config->uid, config->gid) != KNOT_EOK) {
......
......@@ -105,4 +105,3 @@ int dnsproxy_unload(struct query_module *self)
mm_free(self->mm, self->ctx);
return KNOT_EOK;
}
......@@ -105,7 +105,7 @@ static struct fstrm_writer* dnstap_unix_writer(const char *path)
struct fstrm_unix_writer_options *opt = NULL;
struct fstrm_writer_options *wopt = NULL;
struct fstrm_writer *writer = NULL;
opt = fstrm_unix_writer_options_init();
if (opt == NULL) {
goto finish;
......@@ -133,7 +133,7 @@ static struct fstrm_writer* dnstap_file_writer(const char *path)
struct fstrm_file_options *fopt = NULL;
struct fstrm_writer_options *wopt = NULL;
struct fstrm_writer *writer = NULL;
fopt = fstrm_file_options_init();
if (fopt == NULL) {
goto finish;
......
......@@ -22,7 +22,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "knot/nameserver/query_module.h"
......
......@@ -498,7 +498,7 @@ static int rosedb_synth(knot_pkt_t *pkt, const knot_dname_t *key, struct iter *i
/* Authority section. */
knot_pkt_begin(pkt, KNOT_AUTHORITY);
/* Not found (zone cut if records exist). */
ret = cache_iter_begin(it, key);
while (ret == KNOT_EOK) {
......@@ -591,7 +591,7 @@ int rosedb_load(struct query_plan *plan, struct query_module *self)
if (self == NULL || plan == NULL) {
return KNOT_EINVAL;
}
struct cache *cache = cache_open(self->param, 0, self->mm);
if (cache == NULL) {
MODULE_ERR("couldn't open db '%s'", self->param);
......@@ -612,4 +612,3 @@ int rosedb_unload(struct query_module *self)
cache_close(self->ctx);
return KNOT_EOK;
}
......@@ -106,14 +106,14 @@ int main(int argc, char *argv[])
break;
}
}
cache_close(cache);
zs_scanner_free(g_scanner);
if (!found) {
return help();
}
return ret;
}
......
......@@ -699,7 +699,7 @@ int ixfr_process_answer(knot_pkt_t *pkt, struct answer_data *adata)
}
return KNOT_NS_PROC_FAIL;
}
if (adata->ext == NULL) {
if (check_format(pkt) != KNOT_EOK) {
IXFRIN_LOG(LOG_WARNING, "malformed response");
......@@ -712,7 +712,7 @@ int ixfr_process_answer(knot_pkt_t *pkt, struct answer_data *adata)
adata->response_type = KNOT_RESPONSE_AXFR;
return axfr_answer_process(pkt, adata);
}
/* Initialize processing with first packet. */
NS_NEED_TSIG_SIGNED(&adata->param->tsig_ctx, 0);
if (!zone_transfer_needed(adata->param->zone, pkt)) {
......
......@@ -53,5 +53,4 @@ int notify_process_query(knot_pkt_t *pkt, struct query_data *qdata);
*/
int notify_process_answer(knot_pkt_t *pkt, struct answer_data *data);
/*! @} */
......@@ -481,7 +481,6 @@ static int process_query_out(knot_layer_t *ctx, knot_pkt_t *pkt)
* Postprocessing.
*/
if (next_state == KNOT_NS_PROC_DONE || next_state == KNOT_NS_PROC_FULL) {
/* Restore original QNAME. */
......
......@@ -6,7 +6,7 @@
/* Compiled-in module headers. */
#include "knot/modules/synth_record.h"
#include "knot/modules/dnsproxy.h"
#ifdef HAVE_ROSEDB
#ifdef HAVE_ROSEDB
#include "knot/modules/rosedb.h"
#endif
#if USE_DNSTAP
......
......@@ -293,7 +293,6 @@ static int process_normal(zone_t *zone, list_t *requests)
return ret;
}
static int process_requests(zone_t *zone, list_t *requests)
{
if (zone == NULL || requests == NULL) {
......@@ -565,4 +564,3 @@ int updates_execute(zone_t *zone)
return KNOT_EOK;
}
......@@ -630,7 +630,6 @@ int dt_stop(dt_unit_t *unit)
return KNOT_EOK;
}
int dt_setaffinity(dthread_t *thread, unsigned* cpu_id, size_t cpu_count)
{
if (thread == NULL) {
......
......@@ -262,7 +262,6 @@ int dt_optimal_size(void);
*/
int dt_is_cancelled(dthread_t *thread);
/*!
* \brief Return thread index in threading unit.
*
......
......@@ -521,7 +521,6 @@ int journal_write_out(journal_t *journal, journal_node_t *n)
return KNOT_EOK;
}
journal_t* journal_open(const char *path, size_t fslimit)
{
if (path == NULL) {
......@@ -941,7 +940,7 @@ static int journal_walk(const char *fn, uint32_t from, uint32_t to,
if (ret != KNOT_EOK) {
goto finish;
}
size_t i = n - journal->nodes;
assert(i < journal->max_nodes);
......
......@@ -138,7 +138,7 @@ int rrset_deserialize(const uint8_t *stream, size_t *stream_size,
rrset == NULL) {
return KNOT_EINVAL;
}
if (sizeof(uint64_t) > *stream_size) {
return KNOT_ESPACE;
}
......@@ -190,4 +190,3 @@ int rrset_deserialize(const uint8_t *stream, size_t *stream_size,
return KNOT_EOK;
}
......@@ -618,4 +618,3 @@ void update_free_zone(zone_contents_t **contents)
free(*contents);
*contents = NULL;
}
......@@ -80,14 +80,14 @@ int apply_changeset_directly(zone_contents_t *contents, changeset_t *ch);
/*!
* \brief Cleanups successful zone updates.
* \param chgs Changesets used to create the update.
*/
void updates_cleanup(list_t *chgs);
/*!
* \brief Cleanups successful zone update.
* \param chgs Changeset used to create the update.
*/
void update_cleanup(changeset_t *change);
......
......@@ -356,4 +356,3 @@ void changeset_iter_clear(changeset_iter_t *it)
it->node_pos = 0;
}
}
......@@ -83,7 +83,7 @@ static int deep_copy_node_data(zone_node_t *node_copy, const zone_node_t *node,
// Clear space for RRs
node_copy->rrs = NULL;
node_copy->rrset_count = 0;
for (uint16_t i = 0; i < node->rrset_count; ++i) {
knot_rrset_t rr = node_rrset_at(node, i);
int ret = node_add_rrset(node_copy, &rr, mm);
......
......@@ -573,4 +573,3 @@ uint32_t bootstrap_next(uint32_t timer)
}
return timer;
}
......@@ -37,4 +37,3 @@ int event_dnssec(zone_t *zone);
/*! \brief Progressive bootstrap retry timer. */
uint32_t bootstrap_next(uint32_t timer);
......@@ -201,4 +201,3 @@ bool zone_load_can_bootstrap(const conf_zone_t *zone_config)
{
return zone_config && !EMPTY_LIST(zone_config->acl.xfr_in);
}
......@@ -249,7 +249,6 @@ int zone_tree_remove(zone_tree_t *tree,
*removed = (zone_node_t *)(*rval);
}
hattrie_del(tree, (char*)lf+1, *lf);
return KNOT_EOK;
}
......
......@@ -327,4 +327,3 @@ bool zone_transfer_needed(const zone_t *zone, const knot_pkt_t *pkt)
return serial_compare(zone_contents_serial(zone->contents),
knot_soa_serial(&soa->rrs)) < 0;
}
......@@ -61,7 +61,7 @@ typedef struct zone
pthread_mutex_t ddns_lock;
size_t ddns_queue_size;
list_t ddns_queue;
/*! \brief Journal access lock. */
pthread_mutex_t journal_lock;
......@@ -124,5 +124,4 @@ size_t zone_update_dequeue(zone_t *zone, list_t *updates);
/*! \brief Returns true if final SOA in transfer has newer serial than zone */
bool zone_transfer_needed(const zone_t *zone, const knot_pkt_t *pkt);
/*! @} */
......@@ -128,7 +128,7 @@ static zone_t *create_zone_from(conf_zone_t *zone_conf, server_t *server)
zone_free(&zone);
return NULL;
}
return zone;
}
......@@ -140,9 +140,9 @@ static zone_t *create_zone_reload(conf_zone_t *zone_conf, server_t *server,
return NULL;
}
zone->contents = old_zone->contents;
const zone_status_t zstatus = zone_file_status(old_zone, zone_conf);
switch (zstatus) {
case ZONE_STATUS_FOUND_UPDATED:
/* Enqueueing makes the first zone load waitable. */
......@@ -161,7 +161,7 @@ static zone_t *create_zone_reload(conf_zone_t *zone_conf, server_t *server,
default:
assert(0);
}
return zone;
}
......@@ -181,7 +181,7 @@ static void reuse_events(zone_t *zone, const time_t *timers)
// Slave-only event.
continue;
}
zone_events_schedule_at(zone, event, timers[event]);
}
}
......@@ -198,10 +198,10 @@ static zone_t *create_zone_new(conf_zone_t *zone_conf, server_t *server)
if (!zone) {
return NULL;
}
time_t timers[ZONE_EVENT_COUNT];
memset(timers, 0, sizeof(timers));
// Get persistent timers
int ret = read_zone_timers(server->timers_db, zone, timers);
if (ret != KNOT_EOK) {
......@@ -211,11 +211,11 @@ static zone_t *create_zone_new(conf_zone_t *zone_conf, server_t *server)
zone_free(&zone);
return NULL;
}
reuse_events(zone, timers);
const zone_status_t zstatus = zone_file_status(NULL, zone_conf);
switch (zstatus) {
case ZONE_STATUS_FOUND_NEW:
if (!zone_expired(timers)) {
......@@ -236,7 +236,7 @@ static zone_t *create_zone_new(conf_zone_t *zone_conf, server_t *server)
}
log_zone_load_info(zone, zone_conf->name, zstatus);
return zone;
}
......@@ -370,7 +370,7 @@ int zonedb_reload(const conf_t *conf, struct server *server)
/* Wait for readers to finish reading old zone database. */
synchronize_rcu();
/* Sweep the timer database. */
sweep_timer_db(server->timers_db, db_new);
......
......@@ -31,7 +31,6 @@
#include "libknot/internal/mempool.h"
#include "libknot/internal/macros.h"
/*----------------------------------------------------------------------------*/
/* Non-API functions */
/*----------------------------------------------------------------------------*/
......
......@@ -148,5 +148,4 @@ void knot_zonedb_free(knot_zonedb_t **db);
*/
void knot_zonedb_deep_free(knot_zonedb_t **db);
/*! @} */
......@@ -49,7 +49,6 @@ static inline void heap_swap(heap_val_t *e1, heap_val_t *e2)
*e2 = tmp;
}
int heap_init(struct heap *h, int (*cmp)(void *, void *), int init_size)
{
int isize = init_size ? init_size : INITIAL_HEAP_SIZE;
......
......@@ -49,5 +49,4 @@ int heap_insert(struct heap *, void *);
int heap_find(struct heap *, void *);
void heap_delete(struct heap *, int);
/*! @} */
......@@ -12,7 +12,7 @@ static int universal_cmp(uint32_t k1, uint32_t k2, hhash_t *tbl);
#define ASORT_PREFIX(X) hhash_##X
#define ASORT_KEY_TYPE uint32_t
#define ASORT_LT(x, y) (universal_cmp((x), (y), tbl) < 0)
#define ASORT_EXTRA_ARGS , hhash_t *tbl
#define ASORT_EXTRA_ARGS , hhash_t *tbl
#include "libknot/internal/array-sort.h"
/* Hopscotch internal defines. */
......@@ -387,7 +387,6 @@ void hhash_build_index(hhash_t* tbl)
tbl->index = NULL;
}
/* Rebuild index. */
uint32_t total = tbl->weight;
if (total == 0) {
......@@ -577,7 +576,6 @@ const char* hhash_iter_key(hhash_iter_t* i, uint16_t* len)
else return hhash_unsorted_iter_key(i, len);
}
value_t *hhash_iter_val(hhash_iter_t* i)
{
if (i->flags & HH_SORTED) return hhash_sorted_iter_val(i);
......
......@@ -39,7 +39,6 @@ void *mm_alloc(mm_ctx_t *mm, size_t size)
}
}
void *mm_realloc(mm_ctx_t *mm, void *what, size_t size, size_t prev_size)
{
if (mm) {
......
......@@ -8,7 +8,6 @@
* of the GNU Lesser General Public License.
*/
#undef LOCAL_DEBUG
#include "libknot/internal/mem.h"
......
......@@ -103,7 +103,6 @@ void mp_flush(struct mempool *pool);
void mp_stats(struct mempool *pool, struct mempool_stats *stats);
uint64_t mp_total_size(struct mempool *pool); /** How many bytes were allocated by the pool. **/
/***
* [[alloc]]
* Allocation routines
......
......@@ -79,7 +79,6 @@ extern int cacheflush(char *addr, int nbytes, int cache);
#define CACHEFLUSH(addr, bytes, cache)
#endif
#include <errno.h>
#include <limits.h>
#include <stddef.h>
......@@ -3912,7 +3911,6 @@ mdb_env_open2(MDB_env *env)
return MDB_SUCCESS;
}
/** Release a reader thread's slot in the reader lock table.
* This function is called automatically when a thread exits.
* @param[in] ptr This points to the slot in the reader lock table.
......@@ -4632,7 +4630,6 @@ mdb_env_close0(MDB_env *env, int excl)
env->me_flags &= ~(MDB_ENV_ACTIVE|MDB_ENV_TXKEY);
}
void ESECT
mdb_env_close(MDB_env *env)
{
......
......@@ -163,7 +163,6 @@ typedef MDB_ID2 *MDB_ID2L;
*/
unsigned mdb_mid2l_search( MDB_ID2L ids, MDB_ID id );
/** Insert an ID2 into a ID2L.
* @param[in,out] ids The ID2L to insert into.
* @param[in] id The ID2 to insert.
......
......@@ -85,7 +85,7 @@ static int set_mapsize(MDB_env *env, size_t map_size)
if (ret != MDB_SUCCESS) {
return lmdb_error_to_knot(ret);
}
return KNOT_EOK;
}
......@@ -112,20 +112,20 @@ static int dbase_open_env(struct lmdb_env *env, struct namedb_lmdb_opts *opts)
mdb_env_close(mdb_env);
return ret;
}
ret = set_mapsize(mdb_env, opts->mapsize);
if (ret != KNOT_EOK) {
mdb_env_close(mdb_env);
return ret;
}
ret = mdb_env_set_maxdbs(mdb_env, opts->maxdbs);
if (ret != MDB_SUCCESS) {
mdb_env_close(mdb_env);
return lmdb_error_to_knot(ret);
}
#ifdef __OpenBSD__
#ifdef __OpenBSD__
/*
* Enforce that MDB_WRITEMAP is set.
*
......@@ -149,10 +149,10 @@ static int dbase_open_env(struct lmdb_env *env, struct namedb_lmdb_opts *opts)
mdb_env_close(mdb_env);
return lmdb_error_to_knot(ret);
}
/* Keep the environment pointer. */
env->env = mdb_env;
return KNOT_EOK;
}
......@@ -192,7 +192,7 @@ static int init(namedb_t **db_ptr, mm_ctx_t *mm, void *arg)
if (env == NULL) {
return KNOT_ENOMEM;
}
memset(env, 0, sizeof(struct lmdb_env));
env->pool = mm;
......@@ -454,7 +454,6 @@ static int del(namedb_txn_t *txn, namedb_val_t *key)
return KNOT_EOK;
}
const namedb_api_t *namedb_lmdb_api(void)
{
static const namedb_api_t api = {
......
......@@ -26,7 +26,7 @@ static int init(namedb_t **db, mm_ctx_t *mm, void *arg)
if (db == NULL || arg == NULL) {
return KNOT_EINVAL;
}
struct namedb_trie_opts *opts = arg;
hattrie_t *trie = hattrie_create_n(opts->bucket_size, mm);
if (!trie) {
......
......@@ -23,7 +23,6 @@ static const uint8_t NODE_TYPE_PURE_BUCKET = 0x2;
static const uint8_t NODE_TYPE_HYBRID_BUCKET = 0x4;
static const uint8_t NODE_HAS_VAL = 0x8;
struct trie_node_t_;
/* Node's may be trie nodes or buckets. This union allows us to keep
......@@ -35,7 +34,6 @@ typedef union node_ptr_
uint8_t* flag;
} node_ptr;
typedef struct trie_node_t_
{
uint8_t flag;
......@@ -544,7 +542,6 @@ static size_t hashnode_nextsize(unsigned items)
return TRIE_BUCKET_SIZE + increment * TRIE_BUCKET_INCR;