1 /* 2 * Copyright (C) the libgit2 contributors. All rights reserved. 3 * 4 * This file is part of libgit2, distributed under the GNU GPL v2 with 5 * a Linking Exception. For full terms see the included COPYING file. 6 */ 7 module libgit2_d.strarray; 8 9 10 /** 11 * @file git2/strarray.h 12 * @brief Git string array routines 13 * @defgroup git_strarray Git string array routines 14 * @ingroup Git 15 * @{ 16 */ 17 extern (C): 18 nothrow @nogc: 19 public: 20 21 /** 22 * Array of strings 23 */ 24 struct git_strarray 25 { 26 char** strings; 27 size_t count; 28 } 29 30 /** 31 * Close a string array object 32 * 33 * This method should be called on `git_strarray` objects where the strings 34 * array is allocated and contains allocated strings, such as what you 35 * would get from `git_strarray_copy()`. Not doing so, will result in a 36 * memory leak. 37 * 38 * This does not free the `git_strarray` itself, since the library will 39 * never allocate that object directly itself (it is more commonly embedded 40 * inside another struct or created on the stack). 41 * 42 * @param array git_strarray from which to free string data 43 */ 44 //GIT_EXTERN 45 void git_strarray_free(.git_strarray* array); 46 47 /** 48 * Copy a string array object from source to target. 49 * 50 * Note: target is overwritten and hence should be empty, otherwise its 51 * contents are leaked. Call git_strarray_free() if necessary. 52 * 53 * @param tgt target 54 * @param src source 55 * @return 0 on success, < 0 on allocation failure 56 */ 57 //GIT_EXTERN 58 int git_strarray_copy(.git_strarray* tgt, const (.git_strarray)* src); 59 60 /** @} */