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 * Free the strings contained in a string array. This method should 32 * be called on `git_strarray` objects that were provided by the 33 * library. Not doing so, will result in a memory leak. 34 * 35 * This does not free the `git_strarray` itself, since the library will 36 * never allocate that object directly itself. 37 * 38 * Params: 39 * array = The git_strarray that contains strings to free 40 */ 41 //GIT_EXTERN 42 void git_strarray_dispose(.git_strarray* array); 43 44 /** 45 * Copy a string array object from source to target. 46 * 47 * Note: target is overwritten and hence should be empty, otherwise its 48 * contents are leaked. Call git_strarray_free() if necessary. 49 * 50 * Params: 51 * tgt = target 52 * src = source 53 * 54 * Returns: 0 on success, < 0 on allocation failure 55 */ 56 //GIT_EXTERN 57 int git_strarray_copy(.git_strarray* tgt, const (.git_strarray)* src); 58 59 /** @} */