diff options
author | Gaël Bonithon <gael@xfce.org> | 2023-04-14 19:40:30 +0200 |
---|---|---|
committer | Gaël Bonithon <gael@xfce.org> | 2023-04-20 16:59:04 +0200 |
commit | 86b4b0453ea3a814167d4a5f7a4031d467543716 (patch) | |
tree | bdb2d4b026c5c75233d91e15c4fbb10775210100 /glib/gshell.c | |
parent | f74589f53041abff29d538a5d9884c3202f2c00a (diff) | |
download | glib-86b4b0453ea3a814167d4a5f7a4031d467543716.tar.gz |
gkeyfile: Fix group comment management
This removes the `comment` member of the GKeyFileGroup structure, which
seemed intended to distinguish comments just above a group from comments
above them, separated by one or more blank lines. Indeed:
* This does not seem to match any specification in the documentation,
where blank lines and lines starting with `#` are indiscriminately
considered comments. In particular, no distinction is made between the
comment above the first group and the comment at the beginning of the
file.
* This distinction was only half implemented, resulting in confusion
between comment above a group and comment at the end of the preceding
group.
Instead, the same logic is used for groups as for keys: the comment
above a group is simply the sequence of key-value pairs of the preceding
group where the key is null, starting from the bottom.
The addition of a blank line above groups when writing, involved in
bugs #104 and #2927, is kept, but:
* It is now added as a comment as soon as the group is added (since a
blank line is considered a comment), so that
`g_key_file_get_comment()` returns the correct result right away.
* It is always added if comments are not kept.
* Otherwise it is only added if the group is newly created (not present
in the original data), in order to really keep comments (existing and
not existing).
Closes: #104, #2927
Diffstat (limited to 'glib/gshell.c')
0 files changed, 0 insertions, 0 deletions