]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Remove some useless casts from and to void pointers
authorJulian Andres Klode <jak@jak-linux.org>
Thu, 6 Oct 2011 19:08:48 +0000 (21:08 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Oct 2011 19:25:24 +0000 (12:25 -0700)
Remove casts from/to void*.  They are unneeded in C, can hide problems
in the future, and are far too C++ish.  Furthermore, they were
inconsistent with the rest of the code and even with regards to
themselves (at least in terms of whether or not to have space after the
cast).

In this case, we temporarily lose const specifiers in libdivecomputer.c
due to the unneeded cast, so it seems better to avoid the cast at all,
so you get warned about a const->non-const cast if you ever change it to
do something like this.

The casts in gtk-gui.c are just useless semantically, although they
might be useful as a hint to the reader that the void pointers are char
arrays.

Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
gtk-gui.c
libdivecomputer.c

index b889f114d86a7a6301aed3a38b8eed407051d79c..4ac538a062bdbe32f72ca71d1401e6446e4ecea2 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -116,7 +116,7 @@ static void file_open(GtkWidget *w, gpointer data)
                
                GError *error = NULL;
                while(filenames != NULL) {
-                       filename = (char *)filenames->data;
+                       filename = filenames->data;
                        parse_xml_file(filename, &error);
                        if (error != NULL)
                        {
@@ -883,7 +883,7 @@ static GtkWidget *xml_file_selector(GtkWidget *vbox, GtkWidget *main_dialog)
 static void do_import_file(gpointer data, gpointer user_data)
 {
        GError *error = NULL;
-       parse_xml_file((char *)data, &error);
+       parse_xml_file(data, &error);
 
        if (error != NULL)
        {
index bcf59eeb588ba463de2de58d3e2af719f00ab8f0..b1c86c5ee8d378ad1852a88e7d396d88885b78a1 100644 (file)
@@ -411,10 +411,10 @@ static device_status_t device_open(const char *devname,
 
 static void event_cb(device_t *device, device_event_t event, const void *data, void *userdata)
 {
-       const device_progress_t *progress = (device_progress_t *) data;
-       const device_devinfo_t *devinfo = (device_devinfo_t *) data;
-       const device_clock_t *clock = (device_clock_t *) data;
-       device_data_t *devdata = (device_data_t *) userdata;
+       const device_progress_t *progress = data;
+       const device_devinfo_t *devinfo = data;
+       const device_clock_t *clock = data;
+       device_data_t *devdata = userdata;
 
        switch (event) {
        case DEVICE_EVENT_WAITING: