diff options
author | Russell Belfer <rb@github.com> | 2013-05-15 09:24:51 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-05-15 16:13:04 -0700 |
commit | 96c01991c166a25d8906c031422f4215edeb8ba0 (patch) | |
tree | 5203dcd90dd9e5671b4accdf7d45ff1c86d29225 /src/index.c | |
parent | 797dfb28fea6a3db542dc32d11a530570e147b73 (diff) | |
download | libgit2-96c01991c166a25d8906c031422f4215edeb8ba0.tar.gz |
Remove entry dup/free functions and fix comments
This removes the functions to duplicate and free copies of a
git_index_entry and updates the comments to explain that you
should just use the public definition of the struct as needed.
Diffstat (limited to 'src/index.c')
-rw-r--r-- | src/index.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/index.c b/src/index.c index f68c81769..f767dfab7 100644 --- a/src/index.c +++ b/src/index.c @@ -550,51 +550,6 @@ const git_index_entry *git_index_get_bypath( return git_index_get_byindex(index, pos); } -typedef struct { - git_index_entry entry; - char pathdata[GIT_FLEX_ARRAY]; -} git_index_entry_with_path; - -git_index_entry *git_index_entry_dup(const git_index_entry *src) -{ - git_index_entry_with_path *tgt; - size_t pathlen; - - if (!src) - return NULL; - - pathlen = strlen(src->path); - - tgt = git__calloc(sizeof(git_index_entry_with_path) + pathlen + 1, 1); - if (!tgt) - return NULL; - - memcpy(&tgt->entry, src, sizeof(tgt->entry)); - tgt->entry.flags_extended |= GIT_IDXENTRY_ALLOCATED; - - memcpy(tgt->pathdata, src->path, pathlen + 1); - tgt->entry.path = tgt->pathdata; - - return (git_index_entry *)tgt; -} - -void git_index_entry_free(git_index_entry *entry) -{ - assert(entry); - - if (!(entry->flags_extended & GIT_IDXENTRY_ALLOCATED)) - return; - - if ((entry->flags_extended & GIT_IDXENTRY_ALLOCATED_PATH) != 0 && - entry->path != ((git_index_entry_with_path *)entry)->pathdata) - git__free(entry->path); - - /* ward off accidental double free */ - entry->flags_extended = (entry->flags_extended & ~GIT_IDXENTRY_ALLOCATED); - - git__free(entry); -} - void git_index_entry__init_from_stat(git_index_entry *entry, struct stat *st) { entry->ctime.seconds = (git_time_t)st->st_ctime; |