commit 057e7eb6f1bc703a5d90e6ca41a5506008b850e9 from: Omar Polo date: Sat Jun 22 21:21:06 2024 UTC make yornp data be a void pointer instead of a tab commit - 5acf19ec96258db04cb04a15bb769cefc9e923f5 commit + 057e7eb6f1bc703a5d90e6ca41a5506008b850e9 blob - 3f89716e58df8fb4fc17d02680a8be4cfa49f5ec blob + 04250afb914714d4ed340644da020f3da8c3479e --- cmd.c +++ cmd.c @@ -275,7 +275,7 @@ cmd_end_of_buffer(struct buffer *buffer) } static void -kill_telescope_cb(int r, struct tab *tab) +kill_telescope_cb(int r, void *data) { if (r) { save_session(); @@ -1134,8 +1134,10 @@ cmd_client_certificate_info(struct buffer *buffer) } static void -unload_certificate_cb(int r, struct tab *tab) +unload_certificate_cb(int r, void *data) { + struct tab *tab = data; + message("Won't use %s for this site.", tab->client_cert); cert_delete_for(tab->client_cert, &tab->iri, r); } blob - 4b502acc02fdf47903bcbe1860135bc137a1753a blob + 68e4e85b92815c076662c309cd47275d90bf0643 --- minibuffer.c +++ minibuffer.c @@ -55,8 +55,8 @@ static void handle_clear_echoarea(int, int, void *); static unsigned long clechotimer; static struct timeval clechotv = { 5, 0 }; -static void (*yornp_cb)(int, struct tab *); -static struct tab *yornp_data; +static void (*yornp_cb)(int, void *); +static void *yornp_data; static void (*read_cb)(const char*, struct tab *); static struct tab *read_data; @@ -447,8 +447,10 @@ toc_select(const char *text) } static void -save_cert_for_site_cb(int r, struct tab *tab) +save_cert_for_site_cb(int r, void *data) { + struct tab *tab = data; + cert_save_for(tab->client_cert, &tab->iri, r); } @@ -612,8 +614,7 @@ exit_minibuffer(void) } void -yornp(const char *prompt, void (*fn)(int, struct tab*), - struct tab *data) +yornp(const char *prompt, void (*fn)(int, void*), void *data) { size_t len; blob - 536bafdb2a728a29982b0cf5e758b2343ebd53db blob + 3fbe22ac1c77f2531259668025199b8cb445025c --- minibuffer.h +++ minibuffer.h @@ -92,7 +92,7 @@ void enter_minibuffer(void(*)(void), void(*)(const ch struct hist *, complfn *, void *, int); void exit_minibuffer(void); -void yornp(const char *, void (*)(int, struct tab *), struct tab *); +void yornp(const char *, void (*)(int, void *), void *); /* * minibuffer_read asks the user for something using the minibuffer. blob - 07fb73cb5c8bef4e70ffe96a09e11a7868948b53 blob + caee7f6b52087f4621b7a75bc883a55834834ac1 --- telescope.c +++ telescope.c @@ -121,9 +121,9 @@ const char *err_pages[70] = { static void die(void) __attribute__((__noreturn__)); static struct tab *tab_by_id(uint32_t); static void handle_imsg_check_cert(struct imsg *); -static void handle_check_cert_user_choice(int, struct tab *); -static void handle_maybe_save_new_cert(int, struct tab *); -static void handle_maybe_save_page(int, struct tab *); +static void handle_check_cert_user_choice(int, void *); +static void handle_maybe_save_new_cert(int, void *); +static void handle_maybe_save_page(int, void *); static void handle_save_page_path(const char *, struct tab *); static void handle_dispatch_imsg(int, int, void *); static void load_about_url(struct tab *, const char *); @@ -239,8 +239,10 @@ handle_imsg_check_cert(struct imsg *imsg) } static void -handle_check_cert_user_choice(int accept, struct tab *tab) +handle_check_cert_user_choice(int accept, void *d) { + struct tab *tab = d; + ui_send_net(IMSG_CERT_STATUS, tab->id, -1, &accept, sizeof(accept)); @@ -272,8 +274,9 @@ handle_check_cert_user_choice(int accept, struct tab * } static void -handle_maybe_save_new_cert(int accept, struct tab *tab) +handle_maybe_save_new_cert(int accept, void *data) { + struct tab *tab = data; struct tofu_entry *e; const char *host, *port; @@ -382,8 +385,9 @@ handle_request_response(struct tab *tab) } static void -handle_maybe_save_page(int dosave, struct tab *tab) +handle_maybe_save_page(int dosave, void *data) { + struct tab *tab = data; const char *f; char input[PATH_MAX]; blob - 0da2d4a759b22e77d116dd27461460787942aaaa blob + b3aac44246bce82d209ffde2fc02cfe429b21132 --- ui.c +++ ui.c @@ -1346,8 +1346,7 @@ ui_after_message_hook(void) } void -ui_yornp(const char *prompt, void (*fn)(int, struct tab *), - struct tab *data) +ui_yornp(const char *prompt, void (*fn)(int, void *), void *data) { yornp(prompt, fn, data); redraw_tab(current_tab); blob - c1ebfb3481771a7f9df065735f436b0f0591f1d4 blob + b8bcbd9cefc98b72e3145e0b46cbf84318f07f98 --- ui.h +++ ui.h @@ -153,7 +153,7 @@ void ui_show_downloads_pane(void); void ui_schedule_redraw(void); void ui_after_message_hook(void); void ui_require_input(struct tab *, int, void (*)(const char *)); -void ui_yornp(const char *, void (*)(int, struct tab *), struct tab *); +void ui_yornp(const char *, void (*)(int, void *), void *); void ui_read(const char *, void (*)(const char *, struct tab *), struct tab *, const char *); void ui_other_window(void); void ui_suspend(void);