summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib.lua2
-rw-r--r--src/lib/clock.c2
-rw-r--r--src/lib/clock.h2
-rw-r--r--src/lib/clock.hh4
-rw-r--r--src/lib/clock.lua2
-rw-r--r--src/lib/getopt.lua2
-rw-r--r--src/lib/ip.lua2
-rw-r--r--src/lib/parseconf.lua2
-rw-r--r--src/lib/trie.c30
9 files changed, 26 insertions, 22 deletions
diff --git a/src/lib.lua b/src/lib.lua
index 3867bbd..c3c7c84 100644
--- a/src/lib.lua
+++ b/src/lib.lua
@@ -1,4 +1,4 @@
--- Copyright (c) 2018-2022, OARC, Inc.
+-- Copyright (c) 2018-2024 OARC, Inc.
-- All rights reserved.
--
-- This file is part of dnsjit.
diff --git a/src/lib/clock.c b/src/lib/clock.c
index 1e7e2c0..9e1c2a3 100644
--- a/src/lib/clock.c
+++ b/src/lib/clock.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2022, OARC, Inc.
+ * Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* This file is part of dnsjit.
diff --git a/src/lib/clock.h b/src/lib/clock.h
index 29d1ee6..45120d9 100644
--- a/src/lib/clock.h
+++ b/src/lib/clock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2022, OARC, Inc.
+ * Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* This file is part of dnsjit.
diff --git a/src/lib/clock.hh b/src/lib/clock.hh
index c3943a6..77e1308 100644
--- a/src/lib/clock.hh
+++ b/src/lib/clock.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2022, OARC, Inc.
+ * Copyright (c) 2018-2024 OARC, Inc.
* All rights reserved.
*
* This file is part of dnsjit.
@@ -18,7 +18,7 @@
* along with dnsjit. If not, see <http://www.gnu.org/licenses/>.
*/
-//lua:require("dnsjit.core.timespec_h")
+// lua:require("dnsjit.core.timespec_h")
typedef enum lib_clock_clkid {
LIB_CLOCK_REALTIME,
diff --git a/src/lib/clock.lua b/src/lib/clock.lua
index 9aec6fa..74c1857 100644
--- a/src/lib/clock.lua
+++ b/src/lib/clock.lua
@@ -1,4 +1,4 @@
--- Copyright (c) 2018-2022, OARC, Inc.
+-- Copyright (c) 2018-2024 OARC, Inc.
-- All rights reserved.
--
-- This file is part of dnsjit.
diff --git a/src/lib/getopt.lua b/src/lib/getopt.lua
index a5dfff6..0622dda 100644
--- a/src/lib/getopt.lua
+++ b/src/lib/getopt.lua
@@ -1,4 +1,4 @@
--- Copyright (c) 2018-2022, OARC, Inc.
+-- Copyright (c) 2018-2024 OARC, Inc.
-- All rights reserved.
--
-- This file is part of dnsjit.
diff --git a/src/lib/ip.lua b/src/lib/ip.lua
index fca3180..839af9b 100644
--- a/src/lib/ip.lua
+++ b/src/lib/ip.lua
@@ -1,4 +1,4 @@
--- Copyright (c) 2018-2022, OARC, Inc.
+-- Copyright (c) 2018-2024 OARC, Inc.
-- All rights reserved.
--
-- This file is part of dnsjit.
diff --git a/src/lib/parseconf.lua b/src/lib/parseconf.lua
index 9a36499..45e04ca 100644
--- a/src/lib/parseconf.lua
+++ b/src/lib/parseconf.lua
@@ -1,4 +1,4 @@
--- Copyright (c) 2018-2022, OARC, Inc.
+-- Copyright (c) 2018-2024 OARC, Inc.
-- All rights reserved.
--
-- This file is part of dnsjit.
diff --git a/src/lib/trie.c b/src/lib/trie.c
index 158c5ca..7a39a7d 100644
--- a/src/lib/trie.c
+++ b/src/lib/trie.c
@@ -39,17 +39,17 @@ enum knot_error {
&& __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
/*!
- * \brief Use a pointer alignment hack to save memory.
- *
- * When on, isbranch() relies on the fact that in leaf_t the first pointer
- * is aligned on multiple of 4 bytes and that the flags bitfield is
- * overlaid over the lowest two bits of that pointer.
- * Neither is really guaranteed by the C standards; the second part should
- * be OK with x86_64 ABI and most likely any other little-endian platform.
- * It would be possible to manipulate the right bits portably, but it would
- * complicate the code nontrivially. C++ doesn't even guarantee type-punning.
- * In debug mode we check this works OK when creating a new trie instance.
- */
+ * \brief Use a pointer alignment hack to save memory.
+ *
+ * When on, isbranch() relies on the fact that in leaf_t the first pointer
+ * is aligned on multiple of 4 bytes and that the flags bitfield is
+ * overlaid over the lowest two bits of that pointer.
+ * Neither is really guaranteed by the C standards; the second part should
+ * be OK with x86_64 ABI and most likely any other little-endian platform.
+ * It would be possible to manipulate the right bits portably, but it would
+ * complicate the code nontrivially. C++ doesn't even guarantee type-punning.
+ * In debug mode we check this works OK when creating a new trie instance.
+ */
#define FLAGS_HACK 1
#else
#define FLAGS_HACK 0
@@ -490,6 +490,10 @@ static int ns_longer_alloc(nstack_t* ns)
memcpy(st, ns->stack, ns->len * sizeof(node_t*));
} else {
st = realloc(ns->stack, new_size);
+ if (st == NULL) {
+ free(ns->stack); // left behind by realloc, callers bail out
+ ns->stack = NULL;
+ }
}
if (st == NULL)
return KNOT_ENOMEM;
@@ -732,8 +736,8 @@ int trie_get_leq(trie_t* tbl, const uint8_t* key, uint32_t len, trie_val_t** val
// but try the previous child if key was less (it may not exist)
bitmap_t b = twigbit(t, key, len);
int i = hastwig(t, b)
- ? twigoff(t, b) - (un_key < un_leaf)
- : twigoff(t, b) - 1 /*twigoff returns successor when !hastwig*/;
+ ? twigoff(t, b) - (un_key < un_leaf)
+ : twigoff(t, b) - 1 /*twigoff returns successor when !hastwig*/;
if (i >= 0) {
ERR_RETURN(ns_longer(ns));
ns->stack[ns->len++] = twig(t, i);