Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from ndevilla:master #9

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Feb 20, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Feb 20, 2024
lmoellendorf and others added 25 commits March 24, 2024 21:46
Support for loading string/custom streams
iniparser_load_file() did not open the file, so it is not its
responsibility to close it.

refs #158
refs #115
The section "12345]" is readable from dictionary directly after
iniparser_set().

The section is also written to file by iniparser_dump_ini() as "[12345]]"

But if the file is parsed by iniparser_load() it is read as "12345".

The reason is that iniparser_load() considers a section name to be
enclosed by "[" and "]". If it find a line enclosed by square brackets it
takes the characters enclosed by and excluding those brackets.

refs #147
This commit will fix an inconsistency in the behavior of `iniparser_set()`
and `iniparser_load()`. It will also make sure that dumping working
dictionary results in an INI file which provides the same dictionary
after loading this INI.

The inconsistency is:

- `iniparser_set()` supports escaped quotes, semicolon and hash in values:
```
"str\"ing" => str"ing
"str;ing" => str;ing
"str#ing" => str#ing
```

-`iniparser_load()` does not support semicolon and hash in unquoted values:
```
str;ing => str
str#ing => str
```
Which is correct, because in this case semicolon and hash indicate that the
rest of the line is a comment.

- `iniparser_load()` supports quotes in unquoted values
```
 str"ing => str"ing
```
- `iniparser_load()` supports semicolon and hash in quoted values:

```
"str;ing" => str;ing
"str#ing" => str#ing
```


However, before this commit:

- `iniparser_load()` did not support escaped quotes in quoted values:

```
"str\"ing" => str\
```

And:

- `iniparser_dump_ini()` wrote all values without quotes

The implemented fix is:

- `iniparser_load()` supports escaping iff the value is quoted
- `iniparser_dump_ini()` will quote all values and escape '\' and '"'

These changes do not break existing test cases.

refs #97
..., declared with attribute warn_unused_result [-Wunused-result]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants