From 1e5e98bd8f5ea0bc15592de454e3629383462371 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 18 Jul 2009 00:43:22 -0700 Subject: [PATCH 1/1] Trim aoview_serial_set_callback args down to just port and callback --- aoview/aoview.h | 4 +--- aoview/aoview_eeprom.c | 2 +- aoview/aoview_monitor.c | 4 +--- aoview/aoview_serial.c | 10 ++++------ 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/aoview/aoview.h b/aoview/aoview.h index 800349ec..4ed0ffab 100644 --- a/aoview/aoview.h +++ b/aoview/aoview.h @@ -160,9 +160,7 @@ typedef void (*aoview_serial_callback)(gpointer user_data, struct aoview_serial void aoview_serial_set_callback(struct aoview_serial *serial, - aoview_serial_callback func, - gpointer data, - GDestroyNotify notify); + aoview_serial_callback func); void aoview_serial_printf(struct aoview_serial *serial, char *format, ...); diff --git a/aoview/aoview_eeprom.c b/aoview/aoview_eeprom.c index 826afc43..34e2deed 100644 --- a/aoview/aoview_eeprom.c +++ b/aoview/aoview_eeprom.c @@ -140,7 +140,7 @@ aoview_eeprom_save(const char *device) serial = aoview_serial_open(device); if (!serial) return FALSE; - aoview_serial_set_callback(serial, aoview_eeprom_callback, serial, NULL); + aoview_serial_set_callback(serial, aoview_eeprom_callback); aoview_serial_printf(serial, "v\nl\n"); return TRUE; } diff --git a/aoview/aoview_monitor.c b/aoview/aoview_monitor.c index 8d120091..dd0e6019 100644 --- a/aoview/aoview_monitor.c +++ b/aoview/aoview_monitor.c @@ -189,8 +189,6 @@ aoview_monitor_connect(char *tty) aoview_table_clear(); aoview_state_reset(); aoview_serial_set_callback(monitor_serial, - aoview_monitor_callback, - monitor_serial, - NULL); + aoview_monitor_callback); return TRUE; } diff --git a/aoview/aoview_serial.c b/aoview/aoview_serial.c index 1d8fefce..f5142ea5 100644 --- a/aoview/aoview_serial.c +++ b/aoview/aoview_serial.c @@ -250,6 +250,7 @@ aoview_serial_open(const char *tty) serial->poll_fd.events = G_IO_IN | G_IO_OUT | G_IO_HUP | G_IO_ERR; g_source_attach(&serial->source, NULL); g_source_add_poll(&serial->source,&serial->poll_fd); + aoview_serial_set_callback(serial, NULL); return serial; } @@ -257,16 +258,13 @@ void aoview_serial_close(struct aoview_serial *serial) { g_source_remove_poll(&serial->source, &serial->poll_fd); + close(serial->fd); g_source_destroy(&serial->source); - g_source_unref(&serial->source); - free(serial); } void aoview_serial_set_callback(struct aoview_serial *serial, - aoview_serial_callback func, - gpointer data, - GDestroyNotify notify) + aoview_serial_callback func) { - g_source_set_callback(&serial->source, (GSourceFunc) func, data, notify); + g_source_set_callback(&serial->source, (GSourceFunc) func, serial, NULL); } -- 2.30.2