]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
elf-util: rename stack_context_destroy() -> stack_context_done()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 28 May 2023 13:56:02 +0000 (22:56 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 31 May 2023 21:47:48 +0000 (06:47 +0900)
src/shared/elf-util.c

index 68d186117f5cf618abd96d98ac6cc017613d4fa2..91f42de40004b5308f6cb8d96fa5df1893cc9ba9 100644 (file)
@@ -158,9 +158,8 @@ typedef struct StackContext {
         Set **modules;
 } StackContext;
 
-static StackContext* stack_context_destroy(StackContext *c) {
-        if (!c)
-                return NULL;
+static void stack_context_done(StackContext *c) {
+        assert(c);
 
         c->f = safe_fclose(c->f);
 
@@ -173,8 +172,6 @@ static StackContext* stack_context_destroy(StackContext *c) {
                 sym_elf_end(c->elf);
                 c->elf = NULL;
         }
-
-        return NULL;
 }
 
 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(Elf *, sym_elf_end, NULL);
@@ -571,8 +568,8 @@ static int parse_core(int fd, const char *executable, char **ret, JsonVariant **
 
         _cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL;
         _cleanup_set_free_ Set *modules = NULL;
-        _cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_destroy) */
-        _cleanup_(stack_context_destroy) StackContext c = {
+        _cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_done) */
+        _cleanup_(stack_context_done) StackContext c = {
                 .package_metadata = &package_metadata,
                 .modules = &modules,
         };
@@ -637,8 +634,8 @@ static int parse_core(int fd, const char *executable, char **ret, JsonVariant **
 static int parse_elf(int fd, const char *executable, char **ret, JsonVariant **ret_package_metadata) {
         _cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL, *elf_metadata = NULL;
         _cleanup_set_free_ Set *modules = NULL;
-        _cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_destroy) */
-        _cleanup_(stack_context_destroy) StackContext c = {
+        _cleanup_free_ char *buf = NULL; /* buf should be freed last, c.f closed first (via stack_context_done) */
+        _cleanup_(stack_context_done) StackContext c = {
                 .package_metadata = &package_metadata,
                 .modules = &modules,
         };