summaryrefslogtreecommitdiffstats
path: root/src/shared/elf-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-05-28 15:56:02 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-05-31 23:47:48 +0200
commita694747d45478336ad9b58d2050ada0fbc92443d (patch)
tree668eb244abe1ea6d96e1288f43ccc9cb4b31370b /src/shared/elf-util.c
parentsd-bus: rename introspect_free() -> introspect_done (diff)
downloadsystemd-a694747d45478336ad9b58d2050ada0fbc92443d.tar.xz
systemd-a694747d45478336ad9b58d2050ada0fbc92443d.zip
elf-util: rename stack_context_destroy() -> stack_context_done()
Diffstat (limited to 'src/shared/elf-util.c')
-rw-r--r--src/shared/elf-util.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/shared/elf-util.c b/src/shared/elf-util.c
index 68d186117f..91f42de400 100644
--- a/src/shared/elf-util.c
+++ b/src/shared/elf-util.c
@@ -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,
};