+2007-12-08 Christian Persch <chpe@gnome.org>
+
+ * shell/ev-metadata-manager.c: (item_free),
+ (ev_metadata_manager_init), (ev_metadata_manager_shutdown),
+ (value_free), (parse_value), (parseItem),
+ (ev_metadata_manager_set_last), (ev_metadata_manager_set),
+ (save_values): Use GSlice to allocate small amounts of memory. Bug
+ #475972.
+
2007-12-05 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-view.c: (ev_view_handle_cursor_over_xy):
static void
item_free (gpointer data)
{
- Item *item;
-
- g_return_if_fail (data != NULL);
-
- item = (Item *)data;
+ Item *item = (Item *) data;
if (item->values != NULL)
g_hash_table_destroy (item->values);
- g_free (item);
+ g_slice_free (Item, item);
}
/**
void
ev_metadata_manager_init (void)
{
- ev_metadata_manager = g_new0 (EvMetadataManager, 1);
+ ev_metadata_manager = g_slice_new0 (EvMetadataManager);
ev_metadata_manager->values_loaded = FALSE;
if (ev_metadata_manager->items != NULL)
g_hash_table_destroy (ev_metadata_manager->items);
- g_free (ev_metadata_manager);
+ g_slice_free (EvMetadataManager, ev_metadata_manager);
ev_metadata_manager = NULL;
}
GValue *value = (GValue *)data;
g_value_unset (value);
- g_free (value);
+ g_slice_free (GValue, value);
}
static GValue *
GValue *ret;
ret_type = g_type_from_name ((char *)type);
- ret = g_new0 (GValue, 1);
+ ret = g_slice_new0 (GValue);
g_value_init (ret, ret_type);
switch (ret_type) {
return;
}
- item = g_new0 (Item, 1);
+ item = g_slice_new0 (Item);
item->atime = g_ascii_strtoull((char*)atime, NULL, 0);
if (item == NULL)
{
- item = g_new0 (Item, 1);
+ item = g_slice_new0 (Item);
g_hash_table_insert (ev_metadata_manager->items,
g_strdup (LAST_URI),
if (value != NULL) {
GValue *new;
- new = g_new0 (GValue, 1);
+ new = g_slice_new0 (GValue);
g_value_init (new, G_VALUE_TYPE (value));
g_value_copy (value, new);
if (item == NULL)
{
- item = g_new0 (Item, 1);
+ item = g_slice_new0 (Item);
g_hash_table_insert (ev_metadata_manager->items,
g_strdup (uri),
if (value != NULL) {
GValue *new;
- new = g_new0 (GValue, 1);
+ new = g_slice_new0 (GValue);
g_value_init (new, G_VALUE_TYPE (value));
g_value_copy (value, new);
switch (G_VALUE_TYPE (value)) {
case G_TYPE_STRING:
- string_value = g_strdup (g_value_get_string (value));
+ string_value = g_value_dup_string (value);
break;
case G_TYPE_INT:
string_value = g_strdup_printf ("%d", g_value_get_int (value));
{
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE, g_value_get_double (value));
- string_value = g_strdup_printf ("%s", buf);
+ string_value = g_strdup (buf);
}
break;
case G_TYPE_BOOLEAN: