|
acab3bc4
|
2011-04-06T15:31:42
|
|
config: move str(n)tolower to the git__ namespace
Non-static functions in a library should always have a prefix
namespace.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
aa793424
|
2011-04-06T15:27:12
|
|
config: coding style fixes
|
|
6776fd51
|
2011-04-06T15:17:06
|
|
config: really compare the variable name case-insensitively
Make cvar_name_match really compare the last part of the variable
ignoring the case.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2470be13
|
2011-04-04T17:06:31
|
|
config: variable name on its own means true
If a variable name appears on its own in a line, it's assumed the
value is true. Store the variable name as NULL in that case.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9b7a6a99
|
2011-04-04T16:17:39
|
|
config: check for EOF before newline
If a line ends at EOF there is no need to check for the newline
character and doing so will cause us to read memory beyond the
allocatd memory as we check for the Windows-style new-line, which is
two bytes long.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
72946881
|
2011-04-04T15:26:43
|
|
config: support multiline values
If a variable value has the traditional continuation character (\) as
the last non-space character in the line, then we continue reading the
value on the next line.
Using more than two lines is also supported.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2454ce78
|
2011-04-04T11:25:55
|
|
config: don't mix buffer reading methods
Make header and variable parse functions use their own buffers instead
of giving them the line they need to read as a parameter which they
mostly ignore.
This is in preparation for multiline configuration variables.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9f1b54d6
|
2011-04-04T15:07:47
|
|
config: also free the file buffer on error
On error, the buffer containing the file contents also needs to be
freed.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
fe116e26
|
2011-04-04T15:33:14
|
|
config: Fix typo and remove debug statement
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
11d0e705
|
2011-03-31T10:50:11
|
|
Add support for subsections
A variable name is stored internally with its section the way it
appeared in the configuration file in order to have the information
about what parts are case-sensitive inline.
Really implement parse_section_header_ext and move the assignment of
variables to config_parse.
The variable name matching is now done in a case-away way by
cvar_name_match and cvar_section_match. Before the user sees it, it's
normalized to the two- or three-dot version.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
0bbaf9aa
|
2011-03-30T16:11:55
|
|
config_parse: no need to check if current_section is non-null
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
923fe455
|
2011-03-30T16:02:57
|
|
Add strtolower and strntolower functions
As parts of variable names are case-sensitive, we need these functions.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
df22949a
|
2011-03-31T12:51:17
|
|
config_set: really replace the value on overwrite
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
6482929b
|
2011-03-30T18:51:02
|
|
move build_varname above parse_section
|
|
d7354d70
|
2011-03-30T16:22:31
|
|
build_varname: lowercase the variable name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
8ecc5ae5
|
2011-03-30T16:48:14
|
|
git_config_set_int: use the right buffer
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
dadc0158
|
2011-03-30T15:05:15
|
|
config: use a singly-linked list instead of a hash table
Such a list preserves the order the variables were first read in which
will be useful later for merging different data-sets. Furthermore,
reading and writing out the same configuration should not reorganize
the variables, which could happen when iterating through all the items
in a hash table.
A hash table is overkill for this small a data-set anyway.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
d28830c2
|
2011-03-30T13:40:19
|
|
Store the parsed variables
Store the key-value pair as strings.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
934fcf78
|
2011-03-30T11:32:08
|
|
Initialise the config reader in config_parse
git_config_open shouldn't have to initialise variables that are only
used inside config_parse and its callees.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2974aa94
|
2011-03-30T11:30:40
|
|
Determine variable type at runtime
Config variables should be interpreted at run-time, as we don't know if a
zero means false or zero, or if yes means true or "yes".
As a variable has no intrinsic type, git_cvtype is gone and the public
API takes care of enforcing a few rules.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2e445cac
|
2011-03-30T11:07:09
|
|
build_varname: allocate memory
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9a3c5e55
|
2011-03-29T17:44:10
|
|
Expose config API for setters, getters and foreach
These functions can be used to query or modify the variables in a
given configuration. No sanity checking is done on the variable names.
This is mostly meant as an API preview.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
26faa366
|
2011-03-29T17:59:13
|
|
Add build_varname to make a full var name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
e15afc8e
|
2011-03-29T17:37:03
|
|
cvar_free: also free the config var's name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
3d23b74a
|
2011-03-29T13:50:37
|
|
Free the config var hash contents in git_config_free
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9f7f4122
|
2011-03-29T12:19:53
|
|
Don't leak if config parsing fails
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
4e02504f
|
2011-03-29T12:10:30
|
|
Move config to support the new hash code
The hashes have been copied from the references code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
3b4835c2
|
2011-03-28T18:07:22
|
|
Correctly parse the section header
If cfg_readline consumes the line, then parse_section_header will read
past it and if we read a character, parse_variable won't have the full
name.
This solution is a bit hackish, but it's the simplest way to get the
code to parse correctly.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
908afb77
|
2011-03-28T17:53:04
|
|
parse_section_header: save the name where it belongs
Save the location of the name in section_out instead of returning it
as an int. Use the return code to signal success or failure.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
e4c796f1
|
2011-03-28T17:51:18
|
|
Read and parse the confguration when openingt the config file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
a69053c7
|
2011-03-28T17:12:53
|
|
Convert config.c to LF
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
5d4cd003
|
2011-03-28T17:02:45
|
|
Move the struct declaration outside config.c
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
a3002d56
|
2011-01-29T01:58:55
|
|
First version - WIP
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|