]> git.ipfire.org Git - pakfire.git/commitdiff
log stream: Change first argument of the callback to ctx
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Mar 2025 16:16:58 +0000 (16:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Mar 2025 16:16:58 +0000 (16:16 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/jail.c
src/pakfire/job.c
src/pakfire/log_stream.c
src/pakfire/log_stream.h
tests/libpakfire/log_stream.c

index da23a1cc1f448aa5b630e371b7a727cd99d79637..71d317dd41687d1a26d083b78d1679a040742975 100644 (file)
@@ -353,21 +353,21 @@ static void pakfire_jail_log_redirect(void* data, int priority, const char* file
 /*
        Passes any log messages on to the context logger
 */
-static int pakfire_jail_INFO(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
+static int pakfire_jail_INFO(struct pakfire_ctx* ctx, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
        INFO(jail->ctx, "%.*s", (int)length, line);
        return 0;
 }
 
-static int pakfire_jail_WARN(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
+static int pakfire_jail_WARN(struct pakfire_ctx* ctx, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
        ERROR(jail->ctx, "%.*s", (int)length, line);
        return 0;
 }
 
-static int pakfire_jail_ERROR(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
+static int pakfire_jail_ERROR(struct pakfire_ctx* ctx, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
        ERROR(jail->ctx, "%.*s", (int)length, line);
@@ -375,7 +375,7 @@ static int pakfire_jail_ERROR(struct pakfire_log_stream* stream, const char* lin
 }
 
 #ifdef ENABLE_DEBUG
-static int pakfire_jail_DEBUG(struct pakfire_log_stream* stream, const char* line, size_t length, void* data) {
+static int pakfire_jail_DEBUG(struct pakfire_ctx* ctx, const char* line, size_t length, void* data) {
        struct pakfire_jail* jail = data;
 
        DEBUG(jail->ctx, "%.*s", (int)length, line);
index 340f9c73a97b924b1b606d18a5abe8de9ebc41bb..8d6cd15e468975524829b14f0a30ce93633611f8 100644 (file)
@@ -525,7 +525,7 @@ static int pakfire_job_send_log(struct pakfire_job* job, int priority, const cha
        return pakfire_daemon_stream_logs(job->daemon);
 }
 
-static int pakfire_job_stdout(struct pakfire_log_stream* stream,
+static int pakfire_job_stdout(struct pakfire_ctx* ctx,
                const char* line, size_t length, void* data) {
        struct pakfire_job* job = data;
 
@@ -533,7 +533,7 @@ static int pakfire_job_stdout(struct pakfire_log_stream* stream,
        return pakfire_job_send_log(job, LOG_INFO, line, length);
 }
 
-static int pakfire_job_stderr(struct pakfire_log_stream* stream,
+static int pakfire_job_stderr(struct pakfire_ctx* ctx,
                const char* line, size_t length, void* data) {
        struct pakfire_job* job = data;
 
index a266e250186e73301219c78548d38c6c530dae5c..75c60ef8a6ec656f415af31b0f2a4a69524b4563 100644 (file)
@@ -279,7 +279,7 @@ static int pakfire_log_stream_drain_buffer(struct pakfire_log_stream* stream) {
                        return r;
 
                // Call the callback
-               r = stream->callback(stream, line, r, stream->data);
+               r = stream->callback(stream->ctx, line, r, stream->data);
                if (r)
                        return r;
 
index f660956c55293d543a99bee60aee3b77cc700835..8328edb7215020fe6106af693f063fb6d1c665a6 100644 (file)
@@ -29,7 +29,7 @@
 
 struct pakfire_log_stream;
 
-typedef int (*pakfire_log_stream_callback)(struct pakfire_log_stream* stream,
+typedef int (*pakfire_log_stream_callback)(struct pakfire_ctx* ctx,
        const char* line, size_t length, void* data);
 
 int pakfire_log_stream_create(struct pakfire_log_stream** stream, struct pakfire_ctx* ctx,
index 022cd29fae622a3ff6f35186041ef7ad090c662f..bd75bf53ff1a1c0c90939914cc6d8c62de59ded4 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "../testsuite.h"
 
-static int log_callback(struct pakfire_log_stream* stream,
+static int log_callback(struct pakfire_ctx* ctx,
                const char* line, size_t length, void* data) {
        int* lines_read = data;