Skip to content
Commit 1f6668a9 authored by Philip Withnall's avatar Philip Withnall 🚫 Committed by Philip Withnall
Browse files

reader: Maintain a stack of member names

This fixes the case where, with nested objects, we call:
    json_reader_read_member (reader, "outer");
    // json_reader_get_member_name (reader) == "outer"

    json_reader_read_member (reader, "inner");
    // json_reader_get_member_name (reader) == "inner"
    // do something useful
    json_reader_end_member (reader);
but at the end, the following assertion no longer holds:
    // json_reader_get_member_name (reader) == "outer"
even though the JsonReader state should have been reset after ending the
inner node.

Fix it by maintaining a stack of member names. This works with both
json_reader_read_member() and json_reader_read_element(). Updates to the
unit tests are included.

https://bugzilla.gnome.org/show_bug.cgi?id=741824
parent 23e69e79
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment