]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib: cleanup
authorMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 9 Jun 2015 23:52:24 +0000 (01:52 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 9 Jun 2015 23:52:24 +0000 (01:52 +0200)
daemon/worker.c
lib/generic/lru.h
lib/layer/iterate.c
lib/zonecut.c

index fb97ac6a6273f40778629d48598019d0cdd9a4c3..2f96a8a0ee9c9619264b77b60bea9e0fa1b12e8f 100644 (file)
@@ -73,7 +73,7 @@ static struct qr_task *qr_task_create(struct worker_ctx *worker, uv_handle_t *ha
                pool.ctx = array_tail(worker->pools);
                array_pop(worker->pools);
        } else { /* No mempool on the freelist, create new one */
-               pool.ctx = mp_new (KNOT_WIRE_MAX_PKTSIZE);
+               pool.ctx = mp_new (16 * CPU_PAGE_SIZE);
        }
 
        /* Create worker task */
index 1b38708aed867ce621806f6e8cdb6e6774ea3fef..2107e998098c71c115a72919cf72b3aee79c76b4 100644 (file)
@@ -139,7 +139,6 @@ static inline void *lru_slot_set(struct lru_hash_base *lru, const char *key, uin
                memset(slot, 0, lru->stride);
                slot->key = malloc(len);
                if (!slot->key) {
-                       slot->len = 0;
                        return NULL;
                }
                memcpy(slot->key, key, len);
index d0375f1cf54c239007e8b4c787ce12dc494ec69f..814893d16cb02b9f86d5e259f46398ff23f141ac 100644 (file)
@@ -57,7 +57,7 @@ static const knot_dname_t *minimized_qname(struct kr_query *query, uint16_t *qty
        /* Minimize name to contain current zone cut + 1 label. */
        int cut_labels = knot_dname_labels(query->zone_cut.name, NULL);
        int qname_labels = knot_dname_labels(qname, NULL);
-       while(qname_labels > cut_labels + 1) {
+       while(qname[0] && qname_labels > cut_labels + 1) {
                qname = knot_wire_next_label(qname, NULL);
                qname_labels -= 1;
        }
index d779b482d305bdf9fddb89372df13bedd4259496..810dc96a305238dbe54ce39eb96ac51cd8e08959 100644 (file)
@@ -261,7 +261,7 @@ int kr_zonecut_find_cached(struct kr_context *ctx, struct kr_zonecut *cut, const
                        update_cut_name(cut, name);
                        return kr_ok();
                }
-               if (!name || !name[0]) {
+               if (name[0] == '\0') {
                        break;
                }
                /* Subtract label from QNAME. */