summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-13 17:02:23 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-13 17:02:23 +0000
commit5fa0059f75261c78e15ecd9990cd72f1ece4a5e4 (patch)
tree1d40443108801bef10b829b30aa843fcf626a461 /src
parentff9c276c144bc24c70f1d5b531a8fd412c34c3d9 (diff)
downloadtipidee-5fa0059f75261c78e15ecd9990cd72f1ece4a5e4.tar.gz
tipidee-5fa0059f75261c78e15ecd9990cd72f1ece4a5e4.tar.xz
tipidee-5fa0059f75261c78e15ecd9990cd72f1ece4a5e4.zip
With fewer bugs
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r--src/config/confnode.c2
-rw-r--r--src/config/conftree.c4
-rw-r--r--src/config/defaults.c10
-rw-r--r--src/libtipidee/tipidee_conf_get.c3
4 files changed, 7 insertions, 12 deletions
diff --git a/src/config/confnode.c b/src/config/confnode.c
index 2d5aeea..abcf962 100644
--- a/src/config/confnode.c
+++ b/src/config/confnode.c
@@ -29,6 +29,6 @@ void confnode_start (confnode *node, char const *key, size_t filepos, uint32_t l
 void confnode_add (confnode *node, char const *s, size_t len)
 {
   if (!stralloc_catb(&g.storage, s, len)) dienomem() ;
-  if (g.storage.len >= UINT32_MAX) strerr_diefu1x(100, "add node to configuration tree: too much data") ;
+  if (g.storage.len >= UINT32_MAX) diestorage() ;
   node->datalen += len ;
 }
diff --git a/src/config/conftree.c b/src/config/conftree.c
index 4eac28e..47bf4fb 100644
--- a/src/config/conftree.c
+++ b/src/config/conftree.c
@@ -34,7 +34,6 @@ static struct nodestore_s nodestore = \
   .tree = AVLTREE_INIT(8, 3, 8, &confnode_dtok, &confnode_cmp, &nodestore.set) \
 } ;
 
-
 confnode const *conftree_search (char const *key)
 {
   uint32_t i ;
@@ -64,14 +63,13 @@ void conftree_update (confnode const *node)
 static int confnode_write (uint32_t d, unsigned int h, void *data)
 {
   confnode *node = GENSETDYN_P(confnode, &nodestore.set, d) ;
-  cdbmaker *cm = data ;
   (void)h ;
   if ((g.storage.s[node->key] & ~0x20) == 'A')
   {
     g.storage.s[++node->data] |= '@' ;
     node->datalen-- ;
   }
-  return cdbmake_add(cm, g.storage.s + node->key, node->keylen, g.storage.s + node->data, node->datalen) ;
+  return cdbmake_add((cdbmaker *)data, g.storage.s + node->key, node->keylen, g.storage.s + node->data, node->datalen) ;
 }
 
 int conftree_write (cdbmaker *cm)
diff --git a/src/config/defaults.c b/src/config/defaults.c
index 389d84d..69881fb 100644
--- a/src/config/defaults.c
+++ b/src/config/defaults.c
@@ -2,8 +2,6 @@
 
 #include <stddef.h>
 
-#include <skalibs/uint32.h>
-
 #include <tipidee/log.h>
 #include "tipidee-config-internal.h"
 
@@ -16,13 +14,13 @@ struct defaults_s
 
 #define REC(k, v, n) { .key = (k), .value = (v), .vlen = (n) }
 #define RECS(k, v) REC(k, v, sizeof(v))
-#define RECU32(k, u) { .key = (k), .value = (char const [4]){ UINT32_BIG(u) >> 24 & 0xffu, UINT32_BIG(u) >> 16 & 0xffu, UINT32_BIG(u) >> 8 & 0xffu, UINT32_BIG(u) & 0xffu }, .vlen = 4 }
+#define RECU32(k, u) { .key = (k), .value = (char const [4]){ (u) >> 24 & 0xffu, (u) >> 16 & 0xffu, (u) >> 8 & 0xffu, (u) & 0xffu }, .vlen = 4 }
 
 static struct defaults_s const defaults[] =
 {
-  RECS("G:read_timeout", "\0\0\0"),
-  RECS("G:write_timeout", "\0\0\0"),
-  RECS("G:cgi_timeout", "\0\0\0"),
+  RECU32("G:read_timeout", 0),
+  RECU32("G:write_timeout", 0),
+  RECU32("G:cgi_timeout", 0),
   RECU32("G:max_request_body_length", 8192),
   RECU32("G:max_cgi_body_length", 4194304),
   RECS("G:index_file", "index.html"),
diff --git a/src/libtipidee/tipidee_conf_get.c b/src/libtipidee/tipidee_conf_get.c
index 866ec99..ff948ee 100644
--- a/src/libtipidee/tipidee_conf_get.c
+++ b/src/libtipidee/tipidee_conf_get.c
@@ -4,15 +4,14 @@
 #include <string.h>
 
 #include <skalibs/cdb.h>
-#include <skalibs/lolstdio.h>
 
 #include <tipidee/conf.h>
+#include <tipidee/log.h>
 
 int tipidee_conf_get (tipidee_conf const *conf, char const *key, cdb_data *data)
 {
   size_t keylen = strlen(key) ;
   if (keylen > TIPIDEE_CONF_KEY_MAXLEN) return (errno = EINVAL, 0) ;
-  LOLDEBUG("tipidee_conf_get: looking up %s", key) ;
   switch (cdb_find(&conf->c, data, key, keylen))
   {
     case -1 : return (errno = EILSEQ, 0) ;