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 * Params: 43 * array = git_strarray from which to free string data 44 */ 45 //GIT_EXTERN 46 void git_strarray_free(.git_strarray* array); 47 48 /** 49 * Copy a string array object from source to target. 50 * 51 * Note: target is overwritten and hence should be empty, otherwise its 52 * contents are leaked. Call git_strarray_free() if necessary. 53 * 54 * Params: 55 * tgt = target 56 * src = source 57 * 58 * Returns: 0 on success, < 0 on allocation failure 59 */ 60 //GIT_EXTERN 61 int git_strarray_copy(.git_strarray* tgt, const (.git_strarray)* src); 62 63 /** @} */