Comments (5)
Hi agladysh,
I'm not so sure about this. It's definitely intended behaviour that it
*doesn't* stop on the first error, because otherwise a single typo in a config
file would ruin the whole thing. Though if you do want this behaviour, you can
just have your program bomb out if ini_parse() returns nonzero?
However, if you could give me more specifics about your use case and why this
approach wouldn't work -- I'd be interested in hearing more.
Thanks,
Ben.
Original comment by [email protected]
on 25 Sep 2010 at 1:05
from inih.
Hi, Ben!
I often *want* single typo to ruin the whole thing! Strict mode is at least as
useful as fault-tolerant — for different tasks of course.
I can bomb out afterwards, no problem. In item 1 I was talking about not
parsing whole config if I only want to read a couple of values from it. Same
reasoning as you wrote in your blog entry: "you don’t have to load the whole
file into memory if you don’t need to" — "you don't have to parse whole
file if you don't need to".
But more critical for me is item 2. See this practical example from my Lua
binding to your library:
http://github.com/agladysh/lua-inih/blob/v0.1/src/lua-inih.c#L32-37
I don't want to accumulate errors here (error cames from the Lua callback) —
it will seriously complicate implementation. I want to bail out on first error
and be done with it. Currently I have to rely on indirect checks to know if
we've failed already and want to preserve original error message. If I could
just return <stop right now> from the callback, life would be much simpler.
Thanks,
Alexander.
P.S. By the way, thank you for this useful library! :-)
Original comment by [email protected]
on 25 Sep 2010 at 5:20
from inih.
Anyway, even if you don't want to change current behaviour, please explicitly
document it.
Original comment by [email protected]
on 25 Sep 2010 at 5:22
from inih.
Yes, this one I'd rather not implement, but I have added a comment making it
more explicit in ini.h.
My main reason to keep it as is is to keep it simple -- when would it stop? on
first "critical error", or only on first time callback returned error.
However, I'd consider adding a STOPONFIRSTERROR flag in ini.h (like the
MULTILINE one) if you come up with good reasoning to determine on which errors
it should stop etc.
Original comment by [email protected]
on 27 Sep 2010 at 2:15
from inih.
WontFix, as per my above comment.
Original comment by [email protected]
on 16 Dec 2010 at 2:30
- Changed state: WontFix
from inih.
Related Issues (20)
- pkg-config files have version `undefined` HOT 3
- possible NULL pointer dereference HOT 2
- unittest.sh doesn' report that tests succeeded? HOT 1
- Emit ini file HOT 1
- Error attempting to link against libinih HOT 3
- Expected key/section missing error HOT 3
- Do you have plan to support write feature ? HOT 1
- Do you plan support buid with cmake HOT 3
- how to get all the sections, key-value pairs HOT 3
- Seems to not discard the rest of a long line? HOT 4
- meason.build distro_install option HOT 5
- Duplicate keys cause a trailing \n to be appended? HOT 1
- inih v57 fails to build using GCC 4.8.5 on CentOS 7 HOT 3
- Add support for UTF-16 HOT 5
- Add Cflags.private to support static linking on Windows HOT 1
- strncpy0 should be in ini_ namespace HOT 8
- Undefined symbol when linking with LLD HOT 9
- undefined reference to `INIReader
- undefined reference to 'ini_parse'
- When loading the ini file,, all the spaces in the value will be deleted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inih.