]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
edit-util: make EditFile take reference of EditFileContext
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Mar 2023 08:42:34 +0000 (17:42 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Mar 2023 13:19:22 +0000 (22:19 +0900)
No functional change, just preparation for later commits.

src/shared/edit-util.c
src/shared/edit-util.h

index 822175a47261d0b6342417274c76e4948a636496..212afb9fd5d079adf144152cfdd81925becabad8 100644 (file)
@@ -95,6 +95,7 @@ int edit_files_add(
         }
 
         context->files[context->n_files] = (EditFile) {
+                .context = context,
                 .path = TAKE_PTR(new_path),
                 .original_path = TAKE_PTR(new_original_path),
                 .comment_paths = TAKE_PTR(new_comment_paths),
index 7b705060e471c0a297c97fc79f8ba5735fefd9bb..8c838bcf9569acd19b5c071398e795aa28f5bdf1 100644 (file)
@@ -3,21 +3,25 @@
 
 #include "path-lookup.h"
 
-typedef struct EditFile {
+typedef struct EditFile EditFile;
+typedef struct EditFileContext EditFileContext;
+
+struct EditFile {
+        EditFileContext *context;
         char *path;
         char *original_path;
         char **comment_paths;
         char *temp;
         unsigned line;
-} EditFile;
+};
 
-typedef struct EditFileContext {
+struct EditFileContext {
         EditFile *files;
         size_t n_files;
         const char *marker_start;
         const char *marker_end;
         bool remove_parent;
-} EditFileContext;
+};
 
 void edit_file_context_done(EditFileContext *context);