Skip to content

Commit

Permalink
Make it explicit it's a config-related constant
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalmeida committed Nov 21, 2017
1 parent bf72841 commit 0faa7f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions config_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern void sanitize_str(char *str)

/* find the first occurrence of # to ignore everything that
* follows */
ignore_after = strchr(str, COMMENT_CHR);
ignore_after = strchr(str, CFG_COMMENT_CHR);
if (ignore_after)
// terminate the string at the beginning of the comment
*ignore_after = '\0';
Expand Down Expand Up @@ -172,7 +172,7 @@ static int load_parameter(config_t config, const char *line)
/* strtok changes the original string, which we may not be
* expecting at other points of the program */
snprintf(buf, sizeof(buf), "%s", line);
param = strtok(buf, DELIMITER_CHR);
param = strtok(buf, CFG_DELIMITER_CHR);
/* make sure there are no spaces */
sanitize_str(param);
param_type = get_param_type(param);
Expand All @@ -183,7 +183,7 @@ static int load_parameter(config_t config, const char *line)
return 0;
}
} else {
value = strtok(NULL, DELIMITER_CHR);
value = strtok(NULL, CFG_DELIMITER_CHR);
switch(param_type)
{
case HTTP_PORT:
Expand Down
4 changes: 2 additions & 2 deletions strconst.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#define CONFIG_FILE "/etc/pgdoctor.cfg"
#endif

#define COMMENT_CHR '#'
#define DELIMITER_CHR "="
#define CFG_COMMENT_CHR '#'
#define CFG_DELIMITER_CHR "="

#define STR_PG_CONN_INFO_FMT "host=%s port=%d dbname=%s user=%s " \
"password=%s connect_timeout=%d"
Expand Down

0 comments on commit 0faa7f7

Please sign in to comment.