Skip to content

Commit

Permalink
ini.c: Removed include code.
Browse files Browse the repository at this point in the history
Also reverted stripping of section names.
  • Loading branch information
WhitePeter authored and fwsmit committed Dec 6, 2021
1 parent fbd5198 commit 9b850a9
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,6 @@ struct ini *load_ini_file(FILE *fp)
while (getline(&line, &line_len, fp) != -1) {
line_num++;

/** Crude file inclusion support.
*
* TODO: Beware of include loops! Should we care more than
* warning about it in the manual? */
if (0 == strncmp("@INCLUDE", line, 8) && strchr(line, '=')) {
gchar **split_line = g_strsplit(line, "=", 2);
gchar *inc_path;
/* Double check since previous one would allow "@INCLUDEFOO" */
if (0 == strcmp("@INCLUDE", g_strstrip(split_line[0]))
&& (inc_path = g_strstrip(split_line[1]))) {
LOG_D("Trying to include '%s'", inc_path);
FILE *f;

if ((f = fopen_conf(inc_path))) {
load_ini_file(f);
LOG_D("Closing included file, fd: '%d'", fileno(f));
fclose(f);
} else
g_free(inc_path);
} else
LOG_W("Invalid '@INCLUDE' line '%d'", line_num);

g_strfreev(split_line);
continue;
}

char *start = g_strstrip(line);

if (*start == ';' || *start == '#' || STR_EMPTY(start))
Expand Down

0 comments on commit 9b850a9

Please sign in to comment.