summaryrefslogtreecommitdiff
path: root/saedit
diff options
context:
space:
mode:
authorVasily <danilka.pro@gmail.com>2015-10-31 12:29:20 +0300
committerVasily <danilka.pro@gmail.com>2015-10-31 12:29:20 +0300
commitaff48535003524bc5f0707c3b4da4cc7b86fb5dc (patch)
tree1cce2b0a3f2f32c63f49635853360d5c3000003a /saedit
parent597ebbd6bc86480e763b13c0eee66e14069c7c93 (diff)
downloadtools-aff48535003524bc5f0707c3b4da4cc7b86fb5dc.tar.gz
tools-aff48535003524bc5f0707c3b4da4cc7b86fb5dc.tar.bz2
tools-aff48535003524bc5f0707c3b4da4cc7b86fb5dc.tar.xz
tools-aff48535003524bc5f0707c3b4da4cc7b86fb5dc.zip
Replaced _GMarkupParseContext definition with get postion function for getting line number
Diffstat (limited to 'saedit')
-rw-r--r--saedit/xml.c75
1 files changed, 3 insertions, 72 deletions
diff --git a/saedit/xml.c b/saedit/xml.c
index 6ead8fe..eefc536 100644
--- a/saedit/xml.c
+++ b/saedit/xml.c
@@ -42,77 +42,6 @@ gint xml_node_compare_with_attr_func(const XMLNode *node, const gchar **attr) {
xml_node_get_attr_value(node, attr[0]));
}
-/* redefinition of private _GMarkupParseContext
- TODO: must be removed */
-typedef enum {
- STATE_START,
- STATE_AFTER_OPEN_ANGLE,
- STATE_AFTER_CLOSE_ANGLE,
- STATE_AFTER_ELISION_SLASH, /* the slash that obviates need for end element */
- STATE_INSIDE_OPEN_TAG_NAME,
- STATE_INSIDE_ATTRIBUTE_NAME,
- STATE_AFTER_ATTRIBUTE_NAME,
- STATE_BETWEEN_ATTRIBUTES,
- STATE_AFTER_ATTRIBUTE_EQUALS_SIGN,
- STATE_INSIDE_ATTRIBUTE_VALUE_SQ,
- STATE_INSIDE_ATTRIBUTE_VALUE_DQ,
- STATE_INSIDE_TEXT,
- STATE_AFTER_CLOSE_TAG_SLASH,
- STATE_INSIDE_CLOSE_TAG_NAME,
- STATE_AFTER_CLOSE_TAG_NAME,
- STATE_INSIDE_PASSTHROUGH,
- STATE_ERROR
-} GMarkupParseState;
-
-typedef struct {
- const GMarkupParser *parser;
-
- GMarkupParseFlags flags;
-
- gint line_number;
- gint char_number;
-
- GMarkupParseState state;
-
- gpointer user_data;
- GDestroyNotify dnotify;
-
- /* A piece of character data or an element that
- * hasn't "ended" yet so we haven't yet called
- * the callback for it.
- */
- GString *partial_chunk;
- GSList *spare_chunks;
-
- GSList *tag_stack;
- GSList *tag_stack_gstr;
- GSList *spare_list_nodes;
-
- GString **attr_names;
- GString **attr_values;
- gint cur_attr;
- gint alloc_attrs;
-
- const gchar *current_text;
- gssize current_text_len;
- const gchar *current_text_end;
-
- /* used to save the start of the last interesting thingy */
- const gchar *start;
-
- const gchar *iter;
-
- guint document_empty : 1;
- guint parsing : 1;
- guint awaiting_pop : 1;
- gint balance;
-
- /* subparser support */
- GSList *subparser_stack; /* (GMarkupRecursionTracker *) */
- const char *subparser_element;
- gpointer held_user_data;
-} _GMarkupParseContext;
-
static GMarkupParser parser;
void xml_free (XMLNode *node) {
@@ -190,7 +119,9 @@ static void _start_element_cb ( GMarkupParseContext *context,
p->attributes = (gchar **)g_array_free (attributes, FALSE);
- p->line_number = ((_GMarkupParseContext*)context)->line_number - (((_GMarkupParseContext*)context)->char_number <= 1);
+ gint char_n, line_n;
+ g_markup_parse_context_get_position(context, &line_n, &char_n);
+ p->line_number = line_n - (char_n <= 1 ? 1 : 0);
}
static void _end_element_cb ( GMarkupParseContext *context,