| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
https://fedorahosted.org/sssd/ticket/1857
Discovered by coverity
The code was inaccessibile, if no key is present, the error will
occur before this check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Reviewed all uses or errno. Cleaned places that needed cleaning.
Did not remove <errno.h> yet where it is not needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Move the last comment into the config object
Last comment in the file was previously treated as a special
value in the last section in the configuration object.
That created difficulties while merging. Storing an orphan
comment as part of the config object is a better approach
2. Since the structure of the config object changed
the internal header and serialization required update.
3. Parser code was updated to:
- deal with the last comment on the top level
- make sure the right error codes are returned in
different modes
- pass right information through the layers which caused
some refactoring of the internal calls
- prevent using an already used configuration object
as an input to parser.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This patch makes two internal functions
resusable from different source modules.
|
|
|
|
| |
Spotted style violation.
|
|
|
|
|
| |
If in merge DETECT mode and there were no parsing errors
return error if there were merge collisions.
|
|
|
|
|
|
| |
This patch adds functionality to respect
merge section flags and to process section
collisions differently dpending on these flags.
|
|
|
|
|
| |
Use section line number for error reporting
about the section collisions.
|
|
|
|
|
|
|
|
|
| |
This patch refactores the value processing
function so that it can be used both in
normal mode when velues need to be constrcuted and
saved into the current section (po->sec) and in the
merge mode when values are already constructed
and need to be saved into a po->merge_sec.
|
|
|
|
|
|
|
|
| |
Patch implements three functions:
* Function to detect a collision between two section names.
* Function to empty section from all its keys
* Function to add values one by one from one section to
another.
|
|
|
|
|
|
| |
* Changed parse_error to use save_error function
created in previous commit.
* Fixed comment to be more clear.
|
|
|
|
| |
Create a function to add error into error list.
|
|
|
|
|
| |
Adding new varibles to the internal parsing structure
and initializing them.
|
|
|
|
|
|
| |
The newly created value object was not freed
in case of an error.
Coverity issue 10076.
|
|
|
|
|
|
|
| |
* Rearranged code in parser module and
created a skeleton of the function that will
be responcible for merging sections.
* Added missing static declarations to some functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
This is a reworked patch to add support for explicit
32 and 64 bit values in the config files.
|
|
Time came to split ini_config.c
into many much smaller pieces.
1) ini_parse.c - will have parsing functions
2) ini_get_value.c - will have single value
interpretation functions
3) ini_get_array.c - will have array interpretation
functions.
4) ini_print.c - error printing
5) ini_defines.h - common constants
6) ini_parse.h header for parsing functions
7) ini_list.c - will have list processing functions
|