From 374c8b7171543cb3131c0872fa67156efab587ef Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 22 Mar 2025 16:16:58 +0000 Subject: [PATCH] log stream: Change first argument of the callback to ctx Signed-off-by: Michael Tremer --- src/pakfire/jail.c | 8 ++++---- src/pakfire/job.c | 4 ++-- src/pakfire/log_stream.c | 2 +- src/pakfire/log_stream.h | 2 +- tests/libpakfire/log_stream.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pakfire/jail.c b/src/pakfire/jail.c index da23a1cc..71d317dd 100644 --- a/src/pakfire/jail.c +++ b/src/pakfire/jail.c @@ -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); diff --git a/src/pakfire/job.c b/src/pakfire/job.c index 340f9c73..8d6cd15e 100644 --- a/src/pakfire/job.c +++ b/src/pakfire/job.c @@ -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; diff --git a/src/pakfire/log_stream.c b/src/pakfire/log_stream.c index a266e250..75c60ef8 100644 --- a/src/pakfire/log_stream.c +++ b/src/pakfire/log_stream.c @@ -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; diff --git a/src/pakfire/log_stream.h b/src/pakfire/log_stream.h index f660956c..8328edb7 100644 --- a/src/pakfire/log_stream.h +++ b/src/pakfire/log_stream.h @@ -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, diff --git a/tests/libpakfire/log_stream.c b/tests/libpakfire/log_stream.c index 022cd29f..bd75bf53 100644 --- a/tests/libpakfire/log_stream.c +++ b/tests/libpakfire/log_stream.c @@ -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; -- 2.39.5