Set("DEBUG_ASSERTS");
Set("DEBUG_DIE_BY_ABORT") if Get("CONFIG_DEBUG") > 1;
Set("CDEBUG" => "-ggdb");
+ Set("COPT" => "");
+ Set("COPT2" => "");
} else {
# If building a release version:
Append("COPT" => "-fomit-frame-pointer");
#include "lib/lib.h"
#include "lib/fastbuf.h"
#include "lib/lfs.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include <string.h>
#include <fcntl.h>
static uns mmap_window_size = 16*PAGE_SIZE;
static uns mmap_extend_size = 4*PAGE_SIZE;
-static struct cfitem fbmm_config[] = {
- { "FBMMap", CT_SECTION, NULL },
- { "WindowSize", CT_INT, &mmap_window_size },
- { "ExtendSize", CT_INT, &mmap_extend_size },
- { NULL, CT_STOP, NULL }
+static struct cf_section fbmm_config = {
+ CF_ITEMS {
+ CF_UNS("WindowSize", &mmap_window_size),
+ CF_UNS("ExtendSize", &mmap_extend_size),
+ CF_END
+ }
};
static void CONSTRUCTOR fbmm_init_config(void)
{
- cf_register(fbmm_config);
+ cf_declare_section("FBMMap", &fbmm_config, 0);
}
struct fb_mmap {
*/
#include "lib/lib.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include "lib/fastbuf.h"
#include <unistd.h>
static byte *temp_template = "/tmp/temp%d.%d";
-static struct cfitem temp_config[] = {
- { "Tempfiles", CT_SECTION, NULL },
- { "Template", CT_STRING, &temp_template },
- { NULL, CT_STOP, NULL }
+static struct cf_section temp_config = {
+ CF_ITEMS {
+ CF_STRING("Template", &temp_template),
+ CF_END
+ }
};
static void CONSTRUCTOR temp_init_config(void)
{
- cf_register(temp_config);
+ cf_declare_section("Tempfiles", &temp_config, 0);
}
struct fastbuf *
#include "lib/lib.h"
#include "lib/lists.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include "lib/chartype.h"
#include "lib/ipaccess.h"
return l;
}
+// FIXME: replace by cf_parse_ip()
static byte *
parse_ip(byte **p, u32 *varp)
{
{
byte *p = strchr(c, '/');
char *q;
- struct ipaccess_entry *a = cfg_malloc(sizeof(struct ipaccess_entry));
+ struct ipaccess_entry *a = cf_malloc(sizeof(struct ipaccess_entry));
unsigned long pxlen;
a->allow = is_allow;
#include "lib/lib.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include "lib/fastbuf.h"
#include "lib/lizard.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
+#include <getopt.h>
#include <sys/user.h>
static char *options = CF_SHORT_OPTS "cdtx";
uns action = 't';
uns crash = 0;
log_init(argv[0]);
- while ((opt = cf_getopt(argc, argv, options, CF_NO_LONG_OPTS, NULL)) >= 0)
+ while ((opt = cf_get_opt(argc, argv, options, CF_NO_LONG_OPTS, NULL)) >= 0)
switch (opt)
{
case 'c':
*/
#include "lib/lib.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include "lib/fastbuf.h"
#include <stdio.h>
#include <stdlib.h>
+#include <getopt.h>
struct my1_node
{
struct my_tree t;
struct my2_tree t2;
int i;
- cfdeffile = NULL;
+ cf_def_file = NULL;
log_init(argv[0]);
- while ((opt = cf_getopt(argc, argv, options, CF_NO_LONG_OPTS, NULL)) >= 0)
+ while ((opt = cf_get_opt(argc, argv, options, CF_NO_LONG_OPTS, NULL)) >= 0)
switch (opt)
{
case 'v':
static inline uns P(red_flag) (P(bucket) *node)
{ return ((addr_int_t) node->son[0]) & 1L; }
static inline void P(set_red_flag) (P(bucket) *node, uns flag)
- { (addr_int_t) node->son[0] = (((addr_int_t) node->son[0]) & ~1L) | (flag & 1L); }
+ { node->son[0] = (void*) ( (((addr_int_t) node->son[0]) & ~1L) | (flag & 1L) ); }
static inline P(bucket) * P(tree_son) (P(bucket) *node, uns id)
{ return (void *) (((addr_int_t) node->son[id]) & ~1L); }
static inline void P(set_tree_son) (P(bucket) *node, uns id, P(bucket) *son)
/* Test for sorting routines */
#include "lib/lib.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include "lib/fastbuf.h"
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <getopt.h>
struct key {
char line[4096];
main(int argc, char **argv)
{
log_init(NULL);
- if (cf_getopt(argc, argv, CF_SHORT_OPTS, CF_NO_LONG_OPTS, NULL) >= 0 ||
+ if (cf_get_opt(argc, argv, CF_SHORT_OPTS, CF_NO_LONG_OPTS, NULL) >= 0 ||
optind != argc - 2)
{
fputs("This program supports only the following command-line arguments:\n" CF_USAGE, stderr);
*/
#include "lib/lib.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include "lib/fastbuf.h"
#include <unistd.h>
uns sorter_presort_bufsize = 65536;
uns sorter_stream_bufsize = 65536;
-static struct cfitem sorter_config[] = {
- { "Sorter", CT_SECTION, NULL },
- { "Trace", CT_INT, &sorter_trace },
- { "PresortBuffer", CT_INT, &sorter_presort_bufsize },
- { "StreamBuffer", CT_INT, &sorter_stream_bufsize },
- { NULL, CT_STOP, NULL }
+static struct cf_section sorter_config = {
+ CF_ITEMS {
+ CF_UNS("Trace", &sorter_trace),
+ CF_UNS("PresortBuffer", &sorter_presort_bufsize),
+ CF_UNS("StreamBuffer", &sorter_stream_bufsize),
+ CF_END
+ }
};
static void CONSTRUCTOR sorter_init_config(void)
{
- cf_register(sorter_config);
+ cf_declare_section("Sorter", &sorter_config, 0);
}
uns sorter_pass_counter;
#include "lib/lib.h"
#include "lib/url.h"
#include "lib/chartype.h"
-#include "lib/conf.h"
+#include "lib/conf2.h"
#include <string.h>
#include <stdlib.h>
static uns url_min_repeat_count = 0x7fffffff;
static uns url_max_repeat_length = 0;
-static struct cfitem url_config[] = {
- { "URL", CT_SECTION, NULL },
- { "IgnoreSpaces", CT_INT, &url_ignore_spaces },
- { "IgnoreUnderflow", CT_INT, &url_ignore_underflow },
- { "ComponentSeparators", CT_STRING, &url_component_separators },
- { "MinRepeatCount", CT_INT, &url_min_repeat_count },
- { "MaxRepeatLength", CT_INT, &url_max_repeat_length },
- { NULL, CT_STOP, NULL }
+static struct cf_section url_config = {
+ CF_ITEMS {
+ CF_UNS("IgnoreSpaces", &url_ignore_spaces),
+ CF_UNS("IgnoreUnderflow", &url_ignore_underflow),
+ CF_STRING("ComponentSeparators", &url_component_separators),
+ CF_UNS("MinRepeatCount", &url_min_repeat_count),
+ CF_UNS("MaxRepeatLength", &url_max_repeat_length),
+ CF_END
+ }
};
static void CONSTRUCTOR url_init_config(void)
{
- cf_register(url_config);
+ cf_declare_section("URL", &url_config, 0);
}
/* Escaping and de-escaping */