Commit 63c0cc65 by Edward Thomson Committed by Edward Thomson

config: cleanup some now-unused variables

parent 9c26de0f
...@@ -1504,6 +1504,9 @@ static int read_on_variable( ...@@ -1504,6 +1504,9 @@ static int read_on_variable(
cvar_t *var; cvar_t *var;
int result = 0; int result = 0;
GIT_UNUSED(line);
GIT_UNUSED(line_len);
git__strtolower(var_name); git__strtolower(var_name);
git_buf_printf(&buf, "%s.%s", current_section, var_name); git_buf_printf(&buf, "%s.%s", current_section, var_name);
git__free(var_name); git__free(var_name);
...@@ -1696,6 +1699,8 @@ static int write_on_section( ...@@ -1696,6 +1699,8 @@ static int write_on_section(
struct write_data *write_data = (struct write_data *)data; struct write_data *write_data = (struct write_data *)data;
int result = 0; int result = 0;
GIT_UNUSED(reader);
/* If we were previously in the correct section (but aren't anymore) /* If we were previously in the correct section (but aren't anymore)
* and haven't written our value (for a simple name/value set, not * and haven't written our value (for a simple name/value set, not
* a multivar), then append it to the end of the section before writing * a multivar), then append it to the end of the section before writing
...@@ -1723,7 +1728,9 @@ static int write_on_variable( ...@@ -1723,7 +1728,9 @@ static int write_on_variable(
{ {
struct write_data *write_data = (struct write_data *)data; struct write_data *write_data = (struct write_data *)data;
bool has_matched = false; bool has_matched = false;
int result = 0;
GIT_UNUSED(reader);
GIT_UNUSED(current_section);
/* See if we are to update this name/value pair; first examine name */ /* See if we are to update this name/value pair; first examine name */
if (write_data->in_section && if (write_data->in_section &&
...@@ -1754,7 +1761,11 @@ static int write_on_variable( ...@@ -1754,7 +1761,11 @@ static int write_on_variable(
static int write_on_comment(struct reader **reader, const char *line, size_t line_len, void *data) static int write_on_comment(struct reader **reader, const char *line, size_t line_len, void *data)
{ {
struct write_data *write_data = (struct write_data *)data; struct write_data *write_data;
GIT_UNUSED(reader);
write_data = (struct write_data *)data;
return write_line(write_data, line, line_len); return write_line(write_data, line, line_len);
} }
...@@ -1763,6 +1774,8 @@ static int write_on_eof(struct reader **reader, void *data) ...@@ -1763,6 +1774,8 @@ static int write_on_eof(struct reader **reader, void *data)
struct write_data *write_data = (struct write_data *)data; struct write_data *write_data = (struct write_data *)data;
int result = 0; int result = 0;
GIT_UNUSED(reader);
/* If we are at the EOF and have not written our value (again, for a /* If we are at the EOF and have not written our value (again, for a
* simple name/value set, not a multivar) then we have never seen the * simple name/value set, not a multivar) then we have never seen the
* section in question and should create a new section and write the * section in question and should create a new section and write the
...@@ -1782,9 +1795,7 @@ static int write_on_eof(struct reader **reader, void *data) ...@@ -1782,9 +1795,7 @@ static int write_on_eof(struct reader **reader, void *data)
static int config_write(diskfile_backend *cfg, const char *key, const regex_t *preg, const char* value) static int config_write(diskfile_backend *cfg, const char *key, const regex_t *preg, const char* value)
{ {
int result; int result;
int section_matches = 0, last_section_matched = 0, preg_replaced = 0, write_trailer = 0; char *section, *name, *ldot;
const char *pre_end = NULL, *post_start = NULL, *data_start;
char *current_section = NULL, *section, *name, *ldot;
git_filebuf file = GIT_FILEBUF_INIT; git_filebuf file = GIT_FILEBUF_INIT;
struct reader *reader = git_array_get(cfg->readers, 0); struct reader *reader = git_array_get(cfg->readers, 0);
struct write_data write_data; struct write_data write_data;
...@@ -1803,12 +1814,10 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p ...@@ -1803,12 +1814,10 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
if (result == GIT_ENOTFOUND) { if (result == GIT_ENOTFOUND) {
reader->read_ptr = NULL; reader->read_ptr = NULL;
reader->eof = 1; reader->eof = 1;
data_start = NULL;
git_buf_clear(&reader->buffer); git_buf_clear(&reader->buffer);
} else if (result == 0) { } else if (result == 0) {
reader->read_ptr = reader->buffer.ptr; reader->read_ptr = reader->buffer.ptr;
reader->eof = 0; reader->eof = 0;
data_start = reader->read_ptr;
} else { } else {
git_filebuf_cleanup(&file); git_filebuf_cleanup(&file);
return -1; /* OS error when reading the file */ return -1; /* OS error when reading the file */
......
...@@ -535,7 +535,6 @@ void test_config_write__outside_change(void) ...@@ -535,7 +535,6 @@ void test_config_write__outside_change(void)
void test_config_write__preserves_whitespace_and_comments(void) void test_config_write__preserves_whitespace_and_comments(void)
{ {
const char *file_name = "config-duplicate-header"; const char *file_name = "config-duplicate-header";
const char *entry_name = "remote.origin.url";
const char *n; const char *n;
git_config *cfg; git_config *cfg;
git_buf newfile = GIT_BUF_INIT; git_buf newfile = GIT_BUF_INIT;
...@@ -571,7 +570,6 @@ void test_config_write__preserves_whitespace_and_comments(void) ...@@ -571,7 +570,6 @@ void test_config_write__preserves_whitespace_and_comments(void)
void test_config_write__preserves_entry_with_name_only(void) void test_config_write__preserves_entry_with_name_only(void)
{ {
const char *file_name = "config-empty-value"; const char *file_name = "config-empty-value";
const char *entry_name = "remote.origin.url";
git_config *cfg; git_config *cfg;
git_buf newfile = GIT_BUF_INIT; git_buf newfile = GIT_BUF_INIT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment