projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
short circuit out of a few places where we would allocate zero bytes
[git.git]
/
config.c
diff --git
a/config.c
b/config.c
index
152fa28
..
992e988
100644
(file)
--- a/
config.c
+++ b/
config.c
@@
-11,7
+11,7
@@
#define MAXNAME (256)
static FILE *config_file;
#define MAXNAME (256)
static FILE *config_file;
-static char *config_file_name;
+static c
onst c
har *config_file_name;
static int config_linenr;
static int get_next_char(void)
{
static int config_linenr;
static int get_next_char(void)
{
@@
-458,12
+458,6
@@
int git_config_set_multivar(const char* key, const char* value,
* If .git/config does not exist yet, write a minimal version.
*/
if (stat(config_filename, &st)) {
* If .git/config does not exist yet, write a minimal version.
*/
if (stat(config_filename, &st)) {
- static const char contents[] =
- "#\n"
- "# This is the config file\n"
- "#\n"
- "\n";
-
free(store.key);
/* if nothing to unset, error out */
free(store.key);
/* if nothing to unset, error out */
@@
-474,8
+468,6
@@
int git_config_set_multivar(const char* key, const char* value,
}
store.key = (char*)key;
}
store.key = (char*)key;
-
- write(fd, contents, sizeof(contents)-1);
store_write_section(fd, key);
store_write_pair(fd, key, value);
} else{
store_write_section(fd, key);
store_write_pair(fd, key, value);
} else{
@@
-495,7
+487,7
@@
int git_config_set_multivar(const char* key, const char* value,
store.value_regex = (regex_t*)malloc(sizeof(regex_t));
if (regcomp(store.value_regex, value_regex,
REG_EXTENDED)) {
store.value_regex = (regex_t*)malloc(sizeof(regex_t));
if (regcomp(store.value_regex, value_regex,
REG_EXTENDED)) {
- fprintf(stderr, "Invalid pattern: %s",
+ fprintf(stderr, "Invalid pattern: %s
\n
",
value_regex);
free(store.value_regex);
return 6;
value_regex);
free(store.value_regex);
return 6;