Skip to content

Commit

Permalink
fix broken f_file variable and add note to register funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixEcker committed Jun 28, 2023
1 parent 8c1efcb commit e699e98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion include/mariebuild/mb_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ typedef struct mb_file {
void free_build_file(mb_file* file);

/* Parsing Functions */

/* NOTE: After using any of these registering functions, pointers to members
* of the targeted build-file need to be reassigned since registering
* breaks the old pointers.
*/
int register_sector(struct mb_file* file, char *name);
int register_section(struct mb_sector* sector, char *name);
int register_field(struct mb_section* section, char *name, char *value);
Expand Down
8 changes: 4 additions & 4 deletions src/mb_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ int mb_exec_compile(struct mb_build* build) {
f_file = find_field(build->build_file, pfile_field);
}

/*
* TODO: This breaks the "file" field and potentially some others,
* debug and fix (URGENT)
char pmodeflags_field[] = ".config/mariebuild/mode_flags";
mb_field *f_modeflags = find_field(build->build_file, pmodeflags_field);
if (f_modeflags == NULL) {
register_field(find_section(build->build_file, pmariebuild), "mode_flags"
, "");

// Reassing f_file because the original pointer gets broken by new field
// being registered.
f_file = find_field(build->build_file, pfile_field);
}
*/

while (file != NULL) {
if (f_file->value != NULL) free(f_file->value);
Expand Down

0 comments on commit e699e98

Please sign in to comment.