aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-04-10 15:58:00 +0530
committerRoopesh Chander <roop@roopc.net>2019-04-10 17:57:36 +0530
commit98ebd552086e3bc5ff2c6f74bdeec80d24dfede1 (patch)
treef2bbb76d5ac7133e4d3a3d9d9c6cd3e23572a43d /WireGuard/Shared
parentmacOS: Log view: Stop updating the log once the log view is dismissed (diff)
downloadwireguard-apple-98ebd552086e3bc5ff2c6f74bdeec80d24dfede1.tar.xz
wireguard-apple-98ebd552086e3bc5ff2c6f74bdeec80d24dfede1.zip
Log view: Don't use a global array to store log entries
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/Shared')
-rw-r--r--WireGuard/Shared/Logging/ringlogger.c4
-rw-r--r--WireGuard/Shared/Logging/ringlogger.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/WireGuard/Shared/Logging/ringlogger.c b/WireGuard/Shared/Logging/ringlogger.c
index 563483a..1edfc8d 100644
--- a/WireGuard/Shared/Logging/ringlogger.c
+++ b/WireGuard/Shared/Logging/ringlogger.c
@@ -107,7 +107,7 @@ err:
return ret;
}
-uint32_t view_lines_from_cursor(const struct log *input_log, uint32_t cursor, void(*cb)(const char *, uint64_t))
+uint32_t view_lines_from_cursor(const struct log *input_log, uint32_t cursor, void *ctx, void(*cb)(const char *, uint64_t, void *))
{
struct log *log;
uint32_t l, i = cursor;
@@ -132,7 +132,7 @@ uint32_t view_lines_from_cursor(const struct log *input_log, uint32_t cursor, vo
else
break;
}
- cb(line->line, line->time_ns);
+ cb(line->line, line->time_ns, ctx);
cursor = (i + 1) % MAX_LINES;
}
free(log);
diff --git a/WireGuard/Shared/Logging/ringlogger.h b/WireGuard/Shared/Logging/ringlogger.h
index 7f5b074..c63f3e4 100644
--- a/WireGuard/Shared/Logging/ringlogger.h
+++ b/WireGuard/Shared/Logging/ringlogger.h
@@ -11,7 +11,7 @@
struct log;
void write_msg_to_log(struct log *log, const char *tag, const char *msg);
int write_log_to_file(const char *file_name, const struct log *input_log);
-uint32_t view_lines_from_cursor(const struct log *input_log, uint32_t cursor, void(*)(const char *, uint64_t));
+uint32_t view_lines_from_cursor(const struct log *input_log, uint32_t cursor, void *ctx, void(*)(const char *, uint64_t, void *));
struct log *open_log(const char *file_name);
void close_log(struct log *log);