]> git.ipfire.org Git - pakfire.git/commitdiff
stripper: Create its own type
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 15:10:35 +0000 (15:10 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 Jun 2025 15:10:35 +0000 (15:10 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/build.c
src/pakfire/stripper.c
src/pakfire/stripper.h

index 0228f3b6d057664f3bfe57f9006b47daf7fc2647..7222340e4476781d7da5a72d07bbc4ee16354f5c 100644 (file)
@@ -1727,7 +1727,7 @@ static int pakfire_build_run_post_build_scripts(pakfire_build* build) {
 }
 
 static int pakfire_build_strip(pakfire_build* build) {
-       struct pakfire_stripper* stripper = NULL;
+       pakfire_stripper* stripper = NULL;
        int r;
 
        // Create a new stripper
index 06270808ec8a90c0a167673f73530587e48ca8f2..a00a4c7fb26cdf4dce423b44e9b2d869e4fa729a 100644 (file)
@@ -59,7 +59,7 @@ struct pakfire_stripper {
        int sourcesfd;
 };
 
-static int pakfire_stripper_open_sources(struct pakfire_stripper* self) {
+static int pakfire_stripper_open_sources(pakfire_stripper* self) {
        // Open the source directory
        self->sourcesfd = pakfire_openat(self->pakfire, BUILD_SRC_DIR, O_DIRECTORY|O_PATH);
        if (self->sourcesfd < 0) {
@@ -76,9 +76,9 @@ static int pakfire_stripper_open_sources(struct pakfire_stripper* self) {
        return 0;
 }
 
-int pakfire_stripper_create(struct pakfire_stripper** stripper,
+int pakfire_stripper_create(pakfire_stripper** stripper,
                struct pakfire* pakfire, pakfire_jail* jail, const char* path) {
-       struct pakfire_stripper* self = NULL;
+       pakfire_stripper* self = NULL;
        int r;
 
        // Allocate a new object
@@ -131,7 +131,7 @@ ERROR:
        return r;
 }
 
-static void pakfire_stripper_free(struct pakfire_stripper* self) {
+static void pakfire_stripper_free(pakfire_stripper* self) {
        if (self->sources)
                pakfire_filelist_unref(self->sources);
        if (self->sourcesfd)
@@ -147,13 +147,13 @@ static void pakfire_stripper_free(struct pakfire_stripper* self) {
        free(self);
 }
 
-struct pakfire_stripper* pakfire_stripper_ref(struct pakfire_stripper* self) {
+pakfire_stripper* pakfire_stripper_ref(pakfire_stripper* self) {
        ++self->nrefs;
 
        return self;
 }
 
-struct pakfire_stripper* pakfire_stripper_unref(struct pakfire_stripper* self) {
+pakfire_stripper* pakfire_stripper_unref(pakfire_stripper* self) {
        if (--self->nrefs > 0)
                return self;
 
@@ -163,7 +163,7 @@ struct pakfire_stripper* pakfire_stripper_unref(struct pakfire_stripper* self) {
 
 static int pakfire_stripper_find_elf(
                pakfire_ctx* ctx, pakfire_file* file, void* data) {
-       struct pakfire_stripper* self = data;
+       pakfire_stripper* self = data;
        int r;
 
        // Never try to strip any firmware
@@ -183,7 +183,7 @@ static int pakfire_stripper_find_elf(
 /*
        Scan all files in path and identify ELF files
 */
-static int pakfire_stripper_scan(struct pakfire_stripper* self) {
+static int pakfire_stripper_scan(pakfire_stripper* self) {
        pakfire_filelist* filelist = NULL;
        int r;
 
@@ -211,7 +211,7 @@ ERROR:
 
 static int pakfire_stripper_collect_sources(
                pakfire_ctx* ctx, pakfire_elf* elf, const char* filename, void* data) {
-       struct pakfire_stripper* self = data;
+       pakfire_stripper* self = data;
        pakfire_file* file = NULL;
        int r;
 
@@ -242,7 +242,7 @@ ERROR:
 
 static int pakfire_stripper_copy_sources(
                pakfire_ctx* ctx, pakfire_file* file, void* data) {
-       struct pakfire_stripper* self = data;
+       pakfire_stripper* self = data;
        struct stat st = {};
        char p[PATH_MAX];
        FILE* dst = NULL;
@@ -332,7 +332,7 @@ ERROR:
 #define pakfire_stripper_debug_path(stripper, s, filename, build_id) \
        __pakfire_stripper_debug_path(stripper, s, sizeof(s), filename, build_id)
 
-static int __pakfire_stripper_debug_path(struct pakfire_stripper* self,
+static int __pakfire_stripper_debug_path(pakfire_stripper* self,
                char* buffer, size_t length, pakfire_file* file, const char* build_id) {
        char debugpath[PATH_MAX];
        int r;
@@ -356,7 +356,7 @@ static int __pakfire_stripper_debug_path(struct pakfire_stripper* self,
        return __pakfire_string_format(buffer, length, "%s/%s.debug", debugpath, path);
 }
 
-static int pakfire_stripper_extract_debuginfo(struct pakfire_stripper* self,
+static int pakfire_stripper_extract_debuginfo(pakfire_stripper* self,
                pakfire_file* file, pakfire_elf* elf, const char* build_id_path) {
        int r;
 
@@ -399,7 +399,7 @@ static int pakfire_stripper_extract_debuginfo(struct pakfire_stripper* self,
        return 0;
 }
 
-static int pakfire_stripper_strip_debuginfo(struct pakfire_stripper* self,
+static int pakfire_stripper_strip_debuginfo(pakfire_stripper* self,
                pakfire_file* file, pakfire_elf* elf) {
        char debugpath[PATH_MAX];
        char tmppath[PATH_MAX] = "";
@@ -521,7 +521,7 @@ ERROR:
 
 static int pakfire_stripper_strip(
                pakfire_ctx* ctx, pakfire_file* file, void* data) {
-       struct pakfire_stripper* self = data;
+       pakfire_stripper* self = data;
        pakfire_elf* elf = NULL;
        int r;
 
@@ -551,7 +551,7 @@ ERROR:
        return r;
 }
 
-int pakfire_stripper_run(struct pakfire_stripper* self) {
+int pakfire_stripper_run(pakfire_stripper* self) {
        int r;
 
        // Scan for all ELF files in path
index 1829c21569833a47941dbcf2ff071afb2c0fec72..04f16371f1288872096186f496fec61c3f5f8f2f 100644 (file)
 #define BUILD_SRC_DIR "/build/source"
 #define DEBUG_SRC_DIR "/usr/src/debug"
 
-struct pakfire_stripper;
+typedef struct pakfire_stripper pakfire_stripper;
 
 #include <pakfire/jail.h>
 #include <pakfire/pakfire.h>
 
-int pakfire_stripper_create(struct pakfire_stripper** stripper,
+int pakfire_stripper_create(pakfire_stripper** stripper,
        struct pakfire* pakfire, pakfire_jail* jail, const char* path);
 
-struct pakfire_stripper* pakfire_stripper_ref(struct pakfire_stripper* self);
-struct pakfire_stripper* pakfire_stripper_unref(struct pakfire_stripper* self);
+pakfire_stripper* pakfire_stripper_ref(pakfire_stripper* self);
+pakfire_stripper* pakfire_stripper_unref(pakfire_stripper* self);
 
-int pakfire_stripper_run(struct pakfire_stripper* self);
+int pakfire_stripper_run(pakfire_stripper* self);
 
 #endif /* PAKFIRE_STRIPPER_H */