| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Added a new top level interface funtion
and a unit test for it.
|
|
|
|
|
| |
This patch corrects a problem related to stats being accessed
and evaluated without being initialized.
|
|
|
|
| |
Added unit test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I also realized that error list processing should not be
bound to the file object.
This patch corrects that by moving the error_list and
corresponding count from file object to the config object.
Things updated by the patch:
1. The internal variables are moved from file obj to config obj.
2. The external header is updated to reflect the change
3. Functions are moved from file obj module to config obj module.
4. Parser code is updated because error validation was in
the wrong place
5. Unit test is adjusted to get error list from the right object.
I had to adjust the copy function for the config object.
Copy function does not copy over the error list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Added definition of the parsing flags to the header.
2. Added new argument to the parser.
3. Added function to check the correctness of the line.
4. Added new constants and strings for errors.
5. Refactored function that handles spaces.
6. Moved handle_space since it now calls handle_kvp.
7. Updated handle_kvp to trim spaces at the beginning.
8. Adjusted line inspection to handle any space character.
9. Adjusted exising unit tests. Added parameter to the call.
10. Found couple places where there was a space at the end
of the line and cleaned them.
The additional unit tests will be added in the follow up patch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After some evaluation it became apparent that error level
and collision flags should not be a part of the fileobj
but rather passed directly to the parser function.
This way the interface is more clean and logical.
This patch:
1) Removes the error level and collision flags from
the fileobj
2) Moves validation function from ini_fileobj.c
to ini_configobj.c where it belongs.
3) Moves error level and collision flags arguments
from file open function to the parser function.
4) The internals of the file obj are cleaned
5) Validation of the arguments is moved to parser function.
6) Unit tests are updated.
|
|
|
|
|
|
|
|
| |
Replaced sprintf in the unit test.
Defined constants for sizes and used them.
Wrpapped lines where noticed that they are longer than 80.
Added comments to the places where sprintf is still used
but it is safe to use.
|
|
|
|
|
|
|
| |
Move GNU_SOUCE definition to configure.ac
Change all headers to use config.h.
Move config.h to the top.
Remove errno.h if it is not needed.
|
|
|
|
|
| |
Refactored the defines to enum.
Added support for fetching last value from the section.
|
| |
|
|
|
|
|
|
| |
The parser unit test have been updated to execute the changes
in the parser code.
A new test was added to execute merge code in all possible modes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Duplicate sections in the config tree is a bad idea.
After more evaluation I decided to not allow more than one section
with the same name to be acceptable in the resulting object.
All duplicate sections need to be processed so that only
one section is left as a result. The collision flags control that.
It is OK to remove it as this code has not been released yet.
I also spotted that unit test does not exit if the system()
call was successful but the command it invoked was not.
Fixed that. Also fixed couple spelling mistakes here and there.
|
| |
|
|
|
|
|
|
|
|
|
| |
The unit test was broken. The wrong function was used.
To make sure everything is correct I also added a convenience
function to print the internals if the file context object.
The unit test is fixed to use relative paths consitently.
Also added nice statements at the beggining and the end of
the unit test functions where they were missing.
|
| |
|
|
|
|
|
|
|
|
| |
When running 'make distcheck', all files in the $srcdir are set to
read-only, to ensure that the build does not modify the source.
However, this broke our ability to test file permissions. We will
now copy the file to the builddir and do the tests there, where
we have control.
|
|
|
|
|
|
|
|
|
| |
It occured to me that one of the issues that Coverity
did not like (and I could not understand what it is
complaining about) is related to intializing the variables
in the loop.
This patch adds initialization in the loops.
Also there was an initialization missing in the ini_configobj.c
|
|
|
|
|
|
|
|
|
|
| |
All config file processing functions start with "ini_config".
The only function that does not comply is
ini_print_errors. We can't rename it since
it is a part of the current active interface.
I marked that function needs to be removed when we
remove old interface and created a copy with
the correct name. I also updated unit test accordingly.
|
|
|
|
|
| |
Patch adds two functions. One tests permissions,
another validates if the file has changed or not.
|
|
|
|
| |
Allow closing file without destroying the context.
|
|
|
|
|
|
| |
New test reads smerge.conf in all possible
modes and compares the combined result with
the sexpect.conf function.
|
|
|
|
|
|
| |
Patch adds smerge.conf file to the list
of files to test and adds test for the DETECT
mode for inidividual values.
|
|
|
|
| |
One liner to eliminate compilation warning.
|
|
|
|
|
|
|
|
| |
The paths to test files did not work in
parallel build or 'make diskcheck' cases.
Now they are corrected. All temp files are
created in the build directory and read
from there.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch is the first pass at merging functionality.
It implements merging of values that belong to the same
section. Patch includes:
* Definition of merge flags in doxy format
* Definition of the masks in internal header
* Changes to parser to handle the merging of values.
* Also swithed parser to not use ini_config.h as
I want to switch implementation of the current
interface to new interface at some point.
* New unit test was created.
* New config file for this unit test was added to ini.d
Main code changes are in ini_parse.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Added method to copy configuration.
* Added unit test for it.
* Added method to reset boandary for the
whole configuration.
* Added unit test for it.
* Unit test now can read a file
save it read again and save.
Both saves produce same files!
* Reworked the way the parser was dealing
with empty lines. It was sutting
off the value in the middle
if the folded line consisted of
just spaces.
|
| |
|
|
|
|
|
|
|
|
| |
The patch contains two major pieces of work:
* The beginning of the new INI interface
significantly re-thought and reworked.
* The implementation of the file object.
Parsing was adjusted to use this object.
|
|
|
|
|
|
|
|
|
|
| |
I realized that the new high level interface should be
defined in one file instead of being scattered in many headers.
I would have to eventuallu eliminate ini_configobj.h too
and move everything to the new interface in ini_config.h.
This patch renames couple functions to be consistent
with the naming convention and removes ini_parse.h header.
|
|
The parser is added to the existing module.
The old parsing functuion will be removed when we
switch to the new interface.
Parser logic:
* There is one high level function that wraps the
parser interface. It is at the bottom of the module.
ini_parse_config();
* Internally it creates a perser object
and then runs parser on it.
* At the end parser object is destroyed.
* This object stores the state of the parser.
* The parser has an action queue
* There are several actions that parser can perform
- read line
- inspect read line
- record an error
- process last comment in the file (POST)
* Each action handler determines what to do next
depending upon what has happened.
* Read handler reads lines and enqueues inspection action
in case of success or error action in case of failure.
* Inspection action parses last read line and
treats it either is a:
* Comment
* Section
* New key + value
* Continuation of the value
In case of error the error action is enqueued.
* Error can be fatal or non fatal. It depend on the error_level
flag passed in. If the error is non fatal the read action is
enqueued otherwise parser stops.
* The POST action is a special action to handle comment at
the bottom of the file. The comment is stored with the
value it preceeds so in case there is a comment at
the bottom of the file a special value needs to be created
to hold just the comment.
|