From ee7943c0fd408739b0c6313c679c3c9a2c3a23a0 Mon Sep 17 00:00:00 2001 From: Vo Trung Chi Date: Mon, 6 May 2019 17:31:15 +0700 Subject: parser: Change maximum number of config section This commit includes improvement of related code. Signed-off-by: Vo Trung Chi --- src/shared/dlt_config_file_parser.c | 4 ++-- src/shared/dlt_config_file_parser.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shared') diff --git a/src/shared/dlt_config_file_parser.c b/src/shared/dlt_config_file_parser.c index bf6dfb4..e701341 100644 --- a/src/shared/dlt_config_file_parser.c +++ b/src/shared/dlt_config_file_parser.c @@ -123,7 +123,7 @@ static int dlt_config_file_set_section(DltConfigFile *file, char *name) int section = file->num_sections; /* check if adding another section would exceed max number of sections */ - if (section + 1 >= DLT_CONFIG_FILE_SECTIONS_MAX) { + if (section >= DLT_CONFIG_FILE_SECTIONS_MAX) { dlt_log(LOG_WARNING, "Cannot store more sections\n"); return -1; /* reached max number of sections */ } @@ -538,6 +538,6 @@ int dlt_config_file_get_value(const DltConfigFile *file, } } - dlt_log(LOG_WARNING, "Entry does not exist in section \n"); + dlt_vlog(LOG_WARNING, "Entry does not exist in section: %s\n", key); return -1; } diff --git a/src/shared/dlt_config_file_parser.h b/src/shared/dlt_config_file_parser.h index 915ddc0..acde08c 100644 --- a/src/shared/dlt_config_file_parser.h +++ b/src/shared/dlt_config_file_parser.h @@ -62,7 +62,7 @@ #define DLT_CONFIG_FILE_PATH_MAX_LEN 100 /* absolute path including filename */ #define DLT_CONFIG_FILE_ENTRY_MAX_LEN 100 /* Entry for section, key and value */ #define DLT_CONFIG_FILE_LINE_MAX_LEN 210 -#define DLT_CONFIG_FILE_SECTIONS_MAX 100 +#define DLT_CONFIG_FILE_SECTIONS_MAX 125 #define DLT_CONFIG_FILE_KEYS_MAX 25 /* Maximal keys per section */ typedef struct DltConfigKeyData -- cgit v1.2.1