Skip to content

Commit

Permalink
Skip also lines starting with # when loading config file
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusor committed Apr 23, 2022
1 parent 39a4f47 commit 761aa2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include "ini_base.h"

#define DEFAULT_GROUP_NAME "base"
#define COMMENT_MARK ';'
#define COMMENT_SEMICOLON ';'
#define COMMENT_HASH '#'
#define GROUP_OPEN '['
#define GROUP_CLOSE ']'
#define EQUALS '='
Expand Down Expand Up @@ -89,7 +90,7 @@ int ini_parse(const char *buff, size_t buff_size, struct ini_config *config)
memcpy(line, cur_buff, line_len);

/* comment */
if (cur_char == COMMENT_MARK) { continue; }
if (cur_char == COMMENT_SEMICOLON || cur_char == COMMENT_HASH) { continue; }
/* add new group */
if (cur_char == GROUP_OPEN) {
int grp_end_pos = first_pos_char(GROUP_CLOSE, line, line_len);
Expand Down

0 comments on commit 761aa2c

Please sign in to comment.