[glib/parser] mclasen fixes
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/parser] mclasen fixes
- Date: Fri, 19 Mar 2010 22:04:58 +0000 (UTC)
commit f1f982b8f249da0da52dcb3e9b0ede679efec381
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Mar 19 10:10:47 2010 -0500
mclasen fixes
glib/gvariant-parser.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
index 8f57bd9..767434d 100644
--- a/glib/gvariant-parser.c
+++ b/glib/gvariant-parser.c
@@ -77,7 +77,7 @@ parser_set_error (GError **error,
va_list ap;
va_start (ap, format);
- parser_set_error (error, location, other, format, ap);
+ parser_set_error_va (error, location, other, format, ap);
va_end (ap);
}
@@ -407,10 +407,15 @@ typedef void (*free_func) (AST *ast);
typedef struct
{
- get_pattern_func get_pattern;
- get_value_func get_value;
- get_base_value_func get_base_value;
- free_func free;
+ gchar * (* get_pattern) (AST *ast,
+ GError **error);
+ GVariant * (* get_value) (AST *ast,
+ const GVariantType *type,
+ GError **error);
+ GVariant * (* get_base_value) (AST *ast,
+ const GVariantType *type,
+ GError **error);
+ void (* free) (AST *ast);
} ASTClass;
struct _AST
@@ -478,7 +483,7 @@ ast_resolve (AST *ast,
{
GVariant *value;
gchar *pattern;
- gint i, j;
+ gint i, j = 0;
pattern = ast_get_pattern (ast, error);
@@ -491,7 +496,7 @@ ast_resolve (AST *ast,
* 2) default type for strings is 's'
* 3) default type for integers is 'i'
*/
- for (i = j = 0; pattern[i]; i++)
+ for (i = 0; pattern[i]; i++)
switch (pattern[i])
{
case '*':
@@ -706,7 +711,7 @@ maybe_parse (TokenStream *stream,
else if (!token_stream_consume (stream, "nothing"))
{
- token_stream_set_error (stream, error, TRUE, "uknown keyword");
+ token_stream_set_error (stream, error, TRUE, "unknown keyword");
return NULL;
}
@@ -735,7 +740,7 @@ maybe_wrapper (AST *ast,
if (value == NULL)
return NULL;
- while (depth --> 0)
+ while (depth--)
value = g_variant_new_maybe (NULL, value);
return value;
@@ -885,6 +890,7 @@ tuple_get_pattern (AST *ast,
if (i == tuple->n_children)
result = g_strjoinv ("", parts);
+ /* parts[0] should not be freed */
while (i)
g_free (parts[i--]);
g_free (parts);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]