inih is a simple .INI file parser written in C, designed for embedded systems and low-memory environments.
The tool solves the problem of parsing configuration files in resource-constrained settings where a full-featured parser would be excessive. It uses a callback-based, SAX-style approach where the parser invokes a handler function for each name-value pair it encounters, rather than building an in-memory representation of the entire file. This design keeps memory usage minimal and the implementation compact. The parser supports Python ConfigParser-compatible syntax, including RFC 822-style multi-line entries and colon-separated values, and can read from files, strings, or custom I/O streams via different entry points.
Projects with tight memory budgets or simple configuration needs should consider this tool. It suits embedded systems, firmware, and applications where dependencies must be kept minimal. The implementation is intentionally small and straightforward, making it easy to audit and integrate directly into a codebase. Developers who need more sophisticated configuration handling or prefer building data structures in memory may find the callback model less convenient than alternatives, but for systems where every kilobyte matters, the trade-off favors simplicity.
The project maintains a focused scope with compile-time options to customize behavior without runtime overhead. Options control syntax features like multi-line entries, UTF-8 BOM handling, inline and start-of-line comments, and whether to allow valueless names. Parsing behavior can be tuned to stop on first error, report line numbers to handlers, or trigger callbacks when new sections are encountered. Memory usage remains predictable since no dynamic allocation occurs during parsing.