diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2020-05-29 13:13:19 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-06-01 22:50:28 +0100 |
| commit | 51eff5a58b95f91cbdd8e5caa750964c9f08e895 (patch) | |
| tree | 64cebe7a2646eacd6c1fdd068a17213fef39c23b /include/git2 | |
| parent | a9746b306d32cc2d2bc5d446f6f7ae7c7068ba79 (diff) | |
| download | libgit2-51eff5a58b95f91cbdd8e5caa750964c9f08e895.tar.gz | |
strarray: we should `dispose` instead of `free`
We _dispose_ the contents of objects; we _free_ objects (and their
contents). Update `git_strarray_free` to be `git_strarray_dispose`.
`git_strarray_free` remains as a deprecated proxy function.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/deprecated.h | 24 | ||||
| -rw-r--r-- | include/git2/strarray.h | 16 |
2 files changed, 30 insertions, 10 deletions
diff --git a/include/git2/deprecated.h b/include/git2/deprecated.h index e5e56edae..5f020b399 100644 --- a/include/git2/deprecated.h +++ b/include/git2/deprecated.h @@ -524,6 +524,30 @@ typedef int GIT_CALLBACK(git_headlist_cb)(git_remote_head *rhead, void *payload) /**@}*/ +/** @name Deprecated String Array Functions + * + * These types are retained for backward compatibility. The newer + * versions of these values should be preferred in all new code. + * + * There is no plan to remove these backward compatibility values at + * this time. + */ +/**@{*/ + +/** + * Free the memory referred to by the git_strarray. This is an alias of + * `git_strarray_dispose` and is preserved for backward compatibility. + * + * This function is deprecated, but there is no plan to remove this + * function at this time. + * + * @deprecated Use git_strarray_dispose + * @see git_strarray_dispose + */ +GIT_EXTERN(void) git_strarray_free(git_strarray *array); + +/**@}*/ + /** @name Deprecated Options Initialization Functions * * These functions are retained for backward compatibility. The newer diff --git a/include/git2/strarray.h b/include/git2/strarray.h index 86fa25f3f..0f657e6c5 100644 --- a/include/git2/strarray.h +++ b/include/git2/strarray.h @@ -25,20 +25,16 @@ typedef struct git_strarray { } git_strarray; /** - * Close a string array object - * - * This method should be called on `git_strarray` objects where the strings - * array is allocated and contains allocated strings, such as what you - * would get from `git_strarray_copy()`. Not doing so, will result in a - * memory leak. + * Free the strings contained in a string array. This method should + * be called on `git_strarray` objects that were provided by the + * library. Not doing so, will result in a memory leak. * * This does not free the `git_strarray` itself, since the library will - * never allocate that object directly itself (it is more commonly embedded - * inside another struct or created on the stack). + * never allocate that object directly itself. * - * @param array git_strarray from which to free string data + * @param array The git_strarray that contains strings to free */ -GIT_EXTERN(void) git_strarray_free(git_strarray *array); +GIT_EXTERN(void) git_strarray_dispose(git_strarray *array); /** * Copy a string array object from source to target. |
