]> git.street.me.uk Git - andy/viking.git/commitdiff
Use g_free as free function
authorGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Sat, 23 Jun 2007 16:18:13 +0000 (16:18 +0000)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Sat, 23 Jun 2007 16:18:13 +0000 (16:18 +0000)
No need to test nullity of the pointeur before call free function
because all free function knows that a pointeur could be NULL.

We gained few cycles :-)

src/datasource_google.c

index 54c25b3dbc0a75a9d06743d718642c31cc152370..2e5a3fc1e50c9748cf95f94485906608d3dec6b4 100644 (file)
@@ -89,10 +89,8 @@ static void datasource_google_get_cmd_string ( datasource_google_widgets_t *widg
   *cmd = g_strdup_printf( GOOGLE_DIRECTIONS_STRING, from_quoted, to_quoted );
   *input_type = g_strdup("google");
 
-  if (last_from_str)
-    free(last_from_str);
-  if (last_to_str)
-    free(last_to_str);
+  g_free(last_from_str);
+  g_free(last_to_str);
 
   last_from_str = g_strdup(gtk_entry_get_text ( GTK_ENTRY(widgets->from_entry) ) );
   last_to_str = g_strdup(gtk_entry_get_text ( GTK_ENTRY(widgets->to_entry) ) );