Commit Graph

64 Commits

Author SHA1 Message Date
Carlos Martín Nieto
7288d8b65c Parse section header ext: don't leak on error
Also free the subsection if we find too many quotes

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:33:24 +02:00
Carlos Martín Nieto
7bc9e2aa2f Guard against double-freeing the current section
If parse_section_header{,_ext} return an error, current_section
doesn't get allocated. Set it to NULL after freeing so we don't try to
free it again.

This fixes part 2-2 of Issue #210.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:33:23 +02:00
Carlos Martín Nieto
f2abee47d8 cfg_readline: really ignore empty lines
Simplify cfg_readline and at the same time fix it so that it does
really ignore empty lines.

This fixes point 2-1 of Issue #210

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:33:23 +02:00
Carlos Martín Nieto
a5f43b9536 Config file open: don't free memory that doesn't belong to us
On error, it would free the configuration object even though it didn't
own that memory, which would cause a double-free.

This fixes the first part of Issue #210

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:33:23 +02:00
nulltoken
3a1c431011 Fix compilation warnings in MSVC
This allows to successfully build libgit2 with waf on Windows.
2011-05-24 18:55:35 +02:00
Jakob Pfender
ec9edd5657 config_file.c: Move to new error handling mechanism 2011-05-23 21:38:44 +03:00
Vicent Marti
b0b527e0ad config: Cleanup & renaming of the external API
"git_config_backend" have been renamed to "git_config_file", which
implements a generic interface to access a configuration file -- be it
either on disk, from a DB or whatever mumbojumbo.

I think this makes more sense.
2011-05-20 03:20:12 +03:00
Vicent Martí
274f2c213f Merge pull request #193 from carlosmn/config
A couple of config improvements
2011-05-19 14:18:57 -07:00
Sebastian Schuberth
8133afefe3 Fix a few minor typos in comments and error messages
Regarding "initialize" vs. "initialise", www.dict.cc says the first is American
English whereas the latter in British English. For consistency, we should
stick to American English.
2011-05-19 09:34:58 +02:00
Sebastian Schuberth
765fdf4a0e Use "__inline" instead of "inline" with MSVC
MSVC supports "inline" only in C++ code, not in C code.
2011-05-18 17:31:24 +02:00
Carlos Martín Nieto
6421c49a37 Fix variable name normalization
When I changed it over to use different strings for the variable and
the name, cvar_name_normalize was left behind. Fix this and rename to
cvar_normalize_name to reflect the incompatible change.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-17 19:03:42 +02:00
Vicent Marti
128d37316b config_file: Fix compilation 2011-05-17 15:11:19 +03:00
Carlos Martín Nieto
29dca0883f Move config to the new error methods
Take this opportunity to fix an instance of returning
GIT_EOBJCORRUPTED when malloc failed.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-17 13:41:42 +02:00
Carlos Martín Nieto
c033500549 Move config to a backend structure
Configuration options can come from different sources. Currently,
there is only support for reading them from a flat file, but it might
make sense to read it from a database at some point.

Move the parsing code into src/config_file.c and create an include
file include/git2/config_backend.h to allow for other backends to be
developed.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-10 14:47:20 +02:00