kopia lustrzana https://gitlab.com/Zwarf/picplanner
search: Prefer g_auto* macros
g_autofree will automatically free variables when they go out of scope. g_autoptr will do the same, but using the appropriate freefunc for the given type, e.g. GDateTime -> g_date_time_unref() or GObject -> g_object_unref(). This automatic cleanup reduces the risk of memory leaks and allows getting rid of some lines of code.main
rodzic
e22102e641
commit
933089cf6f
|
@ -41,9 +41,9 @@ find_loc_children (GWeatherLocation *location,
|
|||
{
|
||||
if (gweather_location_get_level (child) == GWEATHER_LOCATION_CITY)
|
||||
{
|
||||
char *location_string_merge;
|
||||
char *location_norm;
|
||||
char *location_string;
|
||||
g_autofree char *location_string_merge = NULL;
|
||||
g_autofree char *location_norm = NULL;
|
||||
g_autofree char *location_string = NULL;
|
||||
const char *city = gweather_location_get_name (child);
|
||||
const char *region = gweather_location_get_name (gweather_location_get_parent (child));
|
||||
const char *country = gweather_location_get_country_name (child);
|
||||
|
@ -66,19 +66,15 @@ find_loc_children (GWeatherLocation *location,
|
|||
G_NORMALIZE_ALL_COMPOSE);
|
||||
location_string = g_utf8_casefold (location_norm, strlen (location_norm));
|
||||
|
||||
g_free (location_string_merge);
|
||||
g_free (location_norm);
|
||||
if (strstr (location_string, search_str))
|
||||
{
|
||||
locations[*iteration] = g_object_ref(child);
|
||||
(*iteration)++;
|
||||
if (*iteration>=NUM_SEARCH_RESULTS)
|
||||
{
|
||||
g_free (location_string);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
g_free (location_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue