summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-11-18 22:45:56 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-11-18 22:45:56 +0100
commitbdd31dd5e832126b2f22fccbe244a1106c241ab0 (patch)
treeb08a2ad0fad57131563aa8c071221bea241128c1 /src/index.c
parent277b7efe493887081ce1dafd91199d0ee9f676c9 (diff)
parente4c93a392763a006d11e1c1dd01c12f85498dad5 (diff)
downloadlibgit2-error-handling.tar.gz
Merge branch 'development' into error-handlingerror-handling
The code in this branch has been modified so it works with the global state introduced in development.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/index.c b/src/index.c
index 7bf5daf2c..1a9745a2c 100644
--- a/src/index.c
+++ b/src/index.c
@@ -138,7 +138,7 @@ static int index_initialize(git_index **index_out, git_repository *owner, const
index->index_file_path = git__strdup(index_path);
if (index->index_file_path == NULL) {
- free(index);
+ git__free(index);
return GIT_ENOMEM;
}
@@ -179,8 +179,8 @@ void git_index_free(git_index *index)
git_vector_free(&index->entries);
git_vector_free(&index->unmerged);
- free(index->index_file_path);
- free(index);
+ git__free(index->index_file_path);
+ git__free(index);
}
void git_index_clear(git_index *index)
@@ -192,15 +192,15 @@ void git_index_clear(git_index *index)
for (i = 0; i < index->entries.length; ++i) {
git_index_entry *e;
e = git_vector_get(&index->entries, i);
- free(e->path);
- free(e);
+ git__free(e->path);
+ git__free(e);
}
for (i = 0; i < index->unmerged.length; ++i) {
git_index_entry_unmerged *e;
e = git_vector_get(&index->unmerged, i);
- free(e->path);
- free(e);
+ git__free(e->path);
+ git__free(e);
}
git_vector_clear(&index->entries);
@@ -262,7 +262,7 @@ int git_index_write(git_index *index)
return git__rethrow(error, "Failed to write index");
}
- if ((error = git_filebuf_commit(&file)) < GIT_SUCCESS)
+ if ((error = git_filebuf_commit(&file, GIT_INDEX_FILE_MODE)) < GIT_SUCCESS)
return git__rethrow(error, "Failed to write index");
if (p_stat(index->index_file_path, &indexst) == 0) {
@@ -334,7 +334,7 @@ static int index_entry_init(git_index_entry **entry_out, git_index *index, const
entry->flags |= (stage << GIT_IDXENTRY_STAGESHIFT);
entry->path = git__strdup(rel_path);
if (entry->path == NULL) {
- free(entry);
+ git__free(entry);
return GIT_ENOMEM;
}
@@ -364,8 +364,8 @@ static void index_entry_free(git_index_entry *entry)
{
if (!entry)
return;
- free(entry->path);
- free(entry);
+ git__free(entry->path);
+ git__free(entry);
}
static int index_insert(git_index *index, git_index_entry *entry, int replace)
@@ -416,8 +416,8 @@ static int index_insert(git_index *index, git_index_entry *entry, int replace)
/* exists, replace it */
entry_array = (git_index_entry **) index->entries.contents;
- free(entry_array[position]->path);
- free(entry_array[position]);
+ git__free(entry_array[position]->path);
+ git__free(entry_array[position]);
entry_array[position] = entry;
return GIT_SUCCESS;