[yelp] Avoid warnings from mixing declarations and code
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Avoid warnings from mixing declarations and code
- Date: Mon, 9 Feb 2015 23:36:17 +0000 (UTC)
commit df4e4b2ded248ad4a2f0dfb578dd6bd04ea14afe
Author: David King <amigadave amigadave com>
Date: Mon Feb 9 16:37:01 2015 +0000
Avoid warnings from mixing declarations and code
libyelp/yelp-info-parser.c | 33 ++++++++++++++++++++++-----------
libyelp/yelp-man-parser.c | 4 +++-
libyelp/yelp-transform.c | 4 ++--
3 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/libyelp/yelp-info-parser.c b/libyelp/yelp-info-parser.c
index eee9722..eabf95e 100644
--- a/libyelp/yelp-info-parser.c
+++ b/libyelp/yelp-info-parser.c
@@ -115,6 +115,10 @@ info_image_get_attributes (gchar const* string)
static xmlNodePtr
info_insert_image (xmlNodePtr parent, GMatchInfo *match_info)
{
+ gchar *title;
+ gchar *text;
+ gchar *alt;
+ xmlNodePtr img;
GHashTable *h = info_image_get_attributes (g_match_info_fetch (match_info, 1));
gchar *source;
if (h)
@@ -124,11 +128,11 @@ info_insert_image (xmlNodePtr parent, GMatchInfo *match_info)
return xmlNewTextChild (parent, NULL, BAD_CAST "para",
BAD_CAST "[broken image]");
- gchar *title = (gchar*)g_hash_table_lookup (h, "title");
- gchar *text = (gchar*)g_hash_table_lookup (h, "text");
- gchar *alt = (gchar*)g_hash_table_lookup (h, "alt");
+ title = (gchar*)g_hash_table_lookup (h, "title");
+ text = (gchar*)g_hash_table_lookup (h, "text");
+ alt = (gchar*)g_hash_table_lookup (h, "alt");
g_hash_table_destroy (h);
- xmlNodePtr img = xmlNewChild (parent, NULL, BAD_CAST "img", NULL);
+ img = xmlNewChild (parent, NULL, BAD_CAST "img", NULL);
xmlNewProp (img, BAD_CAST "src", BAD_CAST source);
xmlNewProp (img, BAD_CAST "title", BAD_CAST (title ? title : ""));
xmlNewProp (img, BAD_CAST "text", BAD_CAST (text ? text : ""));
@@ -179,12 +183,15 @@ static gchar*
join_strings_subset (const gchar *separator,
gchar** strings, gchar** end)
{
+ gchar *ptr;
+ gchar *glob;
+
g_assert(end > strings);
- gchar *ptr = *end;
+ ptr = *end;
*end = NULL;
- gchar *glob = g_strjoinv (separator, strings);
+ glob = g_strjoinv (separator, strings);
*end = ptr;
return glob;
}
@@ -304,6 +311,11 @@ info_body_text (xmlNodePtr parent, xmlNodePtr *paragraph, xmlNsPtr ns,
gboolean inline_p, gchar const *content)
{
xmlNodePtr thepara = NULL;
+ gint content_len;
+ gint pos;
+ GRegex *regex;
+ GMatchInfo *match_info;
+ gchar *after;
if (paragraph == NULL) paragraph = &thepara;
if (!strstr (content, INFO_C_IMAGE_TAG_OPEN)) {
@@ -311,10 +323,9 @@ info_body_text (xmlNodePtr parent, xmlNodePtr *paragraph, xmlNsPtr ns,
return;
}
- gint content_len = strlen (content);
- gint pos = 0;
- GRegex *regex = g_regex_new ("(" INFO_C_IMAGE_TAG_OPEN_RE "((?:[^" INFO_TAG_1 "]|[^" INFO_C_TAG_0 "]+"
INFO_TAG_1 ")*)" INFO_C_TAG_CLOSE_RE ")", 0, 0, NULL);
- GMatchInfo *match_info;
+ content_len = strlen (content);
+ pos = 0;
+ regex = g_regex_new ("(" INFO_C_IMAGE_TAG_OPEN_RE "((?:[^" INFO_TAG_1 "]|[^" INFO_C_TAG_0 "]+" INFO_TAG_1
")*)" INFO_C_TAG_CLOSE_RE ")", 0, 0, NULL);
g_regex_match (regex, content, 0, &match_info);
while (g_match_info_matches (match_info))
@@ -335,7 +346,7 @@ info_body_text (xmlNodePtr parent, xmlNodePtr *paragraph, xmlNsPtr ns,
info_insert_image (parent, match_info);
g_match_info_next (match_info, NULL);
}
- gchar *after = g_strndup (&content[pos], content_len - pos);
+ after = g_strndup (&content[pos], content_len - pos);
info_body_parse_text (parent, paragraph, NULL, TRUE, after);
g_free (after);
}
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index cc4705d..3a93e72 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -501,10 +501,12 @@ get_font (const YelpManParser *parser)
static gboolean
parser_parse_line (YelpManParser *parser, GError **error)
{
+ const struct LineParsePair *p;
+
if (parser->line_no <= 3)
return parse_prologue_line (parser, error);
- const struct LineParsePair *p = line_parsers;
+ p = line_parsers;
while (p->handler != NULL) {
if (g_str_has_prefix (parser->buffer, p->prefix)) {
return p->handler(parser, error);
diff --git a/libyelp/yelp-transform.c b/libyelp/yelp-transform.c
index c9af3e3..f04d230 100644
--- a/libyelp/yelp-transform.c
+++ b/libyelp/yelp-transform.c
@@ -131,10 +131,10 @@ yelp_transform_init (YelpTransform *transform)
static void
yelp_transform_class_init (YelpTransformClass *klass)
{
- exsltRegisterAll ();
-
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ exsltRegisterAll ();
+
object_class->dispose = yelp_transform_dispose;
object_class->finalize = yelp_transform_finalize;
object_class->get_property = yelp_transform_get_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]