app/config/gimprc-unknown.c allocate structs using GSlice.
2007-05-22 Michael Natterer <mitch@gimp.org> * app/config/gimprc-unknown.c * app/config/gimpxmlparser.c: allocate structs using GSlice. svn path=/trunk/; revision=22578
This commit is contained in:

committed by
Michael Natterer

parent
f468e1c251
commit
a0b76f7ab9
@ -1,3 +1,8 @@
|
||||
2007-05-22 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/config/gimprc-unknown.c
|
||||
* app/config/gimpxmlparser.c: allocate structs using GSlice.
|
||||
|
||||
2007-05-22 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/vectors/gimpvectors-import.c: allocate structs using GSlice.
|
||||
|
@ -112,7 +112,7 @@ gimp_rc_add_unknown_token (GimpConfig *config,
|
||||
if (!value)
|
||||
return;
|
||||
|
||||
token = g_new (GimpConfigToken, 1);
|
||||
token = g_slice_new (GimpConfigToken);
|
||||
token->key = g_strdup (key);
|
||||
token->value = g_strdup (value);
|
||||
|
||||
@ -127,7 +127,7 @@ gimp_rc_add_unknown_token (GimpConfig *config,
|
||||
g_object_set_data_full (G_OBJECT (config),
|
||||
GIMP_RC_UNKNOWN_TOKENS,
|
||||
unknown_tokens,
|
||||
(GDestroyNotify) gimp_rc_destroy_unknown_tokens);
|
||||
(GDestroyNotify) gimp_rc_destroy_unknown_tokens);
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,19 +146,18 @@ const gchar *
|
||||
gimp_rc_lookup_unknown_token (GimpConfig *config,
|
||||
const gchar *key)
|
||||
{
|
||||
GimpConfigToken *token;
|
||||
GSList *unknown_tokens;
|
||||
GSList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
|
||||
g_return_val_if_fail (key != NULL, NULL);
|
||||
|
||||
unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
|
||||
GIMP_RC_UNKNOWN_TOKENS);
|
||||
unknown_tokens = g_object_get_data (G_OBJECT (config),
|
||||
GIMP_RC_UNKNOWN_TOKENS);
|
||||
|
||||
for (list = unknown_tokens; list; list = g_slist_next (list))
|
||||
{
|
||||
token = (GimpConfigToken *) list->data;
|
||||
GimpConfigToken *token = list->data;
|
||||
|
||||
if (strcmp (token->key, key) == 0)
|
||||
return token->value;
|
||||
@ -181,19 +180,18 @@ gimp_rc_foreach_unknown_token (GimpConfig *config,
|
||||
GimpConfigForeachFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpConfigToken *token;
|
||||
GSList *unknown_tokens;
|
||||
GSList *list;
|
||||
GSList *unknown_tokens;
|
||||
GSList *list;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONFIG (config));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
unknown_tokens = (GSList *) g_object_get_data (G_OBJECT (config),
|
||||
GIMP_RC_UNKNOWN_TOKENS);
|
||||
unknown_tokens = g_object_get_data (G_OBJECT (config),
|
||||
GIMP_RC_UNKNOWN_TOKENS);
|
||||
|
||||
for (list = unknown_tokens; list; list = g_slist_next (list))
|
||||
{
|
||||
token = (GimpConfigToken *) list->data;
|
||||
GimpConfigToken *token = list->data;
|
||||
|
||||
func (token->key, token->value, user_data);
|
||||
}
|
||||
@ -202,16 +200,15 @@ gimp_rc_foreach_unknown_token (GimpConfig *config,
|
||||
static void
|
||||
gimp_rc_destroy_unknown_tokens (GSList *unknown_tokens)
|
||||
{
|
||||
GimpConfigToken *token;
|
||||
GSList *list;
|
||||
GSList *list;
|
||||
|
||||
for (list = unknown_tokens; list; list = g_slist_next (list))
|
||||
{
|
||||
token = (GimpConfigToken *) list->data;
|
||||
GimpConfigToken *token = list->data;
|
||||
|
||||
g_free (token->key);
|
||||
g_free (token->value);
|
||||
g_free (token);
|
||||
g_slice_free (GimpConfigToken, token);
|
||||
}
|
||||
|
||||
g_slist_free (unknown_tokens);
|
||||
|
@ -59,7 +59,7 @@ gimp_xml_parser_new (const GMarkupParser *markup_parser,
|
||||
|
||||
g_return_val_if_fail (markup_parser != NULL, NULL);
|
||||
|
||||
parser = g_new (GimpXmlParser, 1);
|
||||
parser = g_slice_new (GimpXmlParser);
|
||||
|
||||
parser->context = g_markup_parse_context_new (markup_parser,
|
||||
0, user_data, NULL);
|
||||
@ -297,7 +297,7 @@ gimp_xml_parser_free (GimpXmlParser *parser)
|
||||
g_return_if_fail (parser != NULL);
|
||||
|
||||
g_markup_parse_context_free (parser->context);
|
||||
g_free (parser);
|
||||
g_slice_free (GimpXmlParser, parser);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user