From 3ff6cd884430ac15351f6e984d3f95977c5b0d58 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Sat, 29 Aug 2020 15:44:17 +0800 Subject: [PATCH] ini_file_reader.h: add struct ini_full_context --- HISTORY | 2 +- src/common_define.h | 2 +- src/ini_file_reader.h | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 95dae8d..5e11b5d 100644 --- a/HISTORY +++ b/HISTORY @@ -1,5 +1,5 @@ -Version 1.44 2020-08-24 +Version 1.44 2020-08-29 * add test file src/tests/test_pthread_lock.c * add uniq_skiplist.[hc] * add function split_string_ex diff --git a/src/common_define.h b/src/common_define.h index 0fbf94b..9643431 100644 --- a/src/common_define.h +++ b/src/common_define.h @@ -86,7 +86,7 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind); #define CONF_FILE_DIR "conf" #define DEFAULT_CONNECT_TIMEOUT 10 #define DEFAULT_NETWORK_TIMEOUT 30 -#define DEFAULT_MAX_CONNECTONS 1024 +#define DEFAULT_MAX_CONNECTONS 256 #define DEFAULT_WORK_THREADS 4 #define SYNC_LOG_BUFF_DEF_INTERVAL 10 #define TIME_NONE -1 diff --git a/src/ini_file_reader.h b/src/ini_file_reader.h index 9d161fb..6f7c36e 100644 --- a/src/ini_file_reader.h +++ b/src/ini_file_reader.h @@ -33,6 +33,16 @@ typedef bool (*IniSectionNameFilterFunc)(const char *section_name, const int name_len, void *args); +#define FAST_INI_SET_FULL_CTX_EX(ctx, config_file, sname, ini_context) \ + do { \ + ctx.filename = config_file; \ + ctx.section_name = sname; \ + ctx.context = ini_context; \ + } while (0) + +#define FAST_INI_SET_FULL_CTX(ctx, config_file, sname) \ + FAST_INI_SET_FULL_CTX_EX(ctx, config_file, sname, NULL) + typedef struct ini_item { char name[FAST_INI_ITEM_NAME_SIZE]; @@ -62,6 +72,13 @@ typedef struct ini_context char flags; } IniContext; +typedef struct ini_full_context +{ + const char *filename; + const char *section_name; + IniContext *context; +} IniFullContext; + typedef struct ini_annotation_entry { char *func_name; void *arg; -- GitLab