Blame include/git2/strarray.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_git_strarray_h__
Packit Service 20376f
#define INCLUDE_git_strarray_h__
Packit Service 20376f
Packit Service 20376f
#include "common.h"
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * @file git2/strarray.h
Packit Service 20376f
 * @brief Git string array routines
Packit Service 20376f
 * @defgroup git_strarray Git string array routines
Packit Service 20376f
 * @ingroup Git
Packit Service 20376f
 * @{
Packit Service 20376f
 */
Packit Service 20376f
GIT_BEGIN_DECL
Packit Service 20376f
Packit Service 20376f
/** Array of strings */
Packit Service 20376f
typedef struct git_strarray {
Packit Service 20376f
	char **strings;
Packit Service 20376f
	size_t count;
Packit Service 20376f
} git_strarray;
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Close a string array object
Packit Service 20376f
 *
Packit Service 20376f
 * This method should be called on `git_strarray` objects where the strings
Packit Service 20376f
 * array is allocated and contains allocated strings, such as what you
Packit Service 20376f
 * would get from `git_strarray_copy()`.  Not doing so, will result in a
Packit Service 20376f
 * memory leak.
Packit Service 20376f
 *
Packit Service 20376f
 * This does not free the `git_strarray` itself, since the library will
Packit Service 20376f
 * never allocate that object directly itself (it is more commonly embedded
Packit Service 20376f
 * inside another struct or created on the stack).
Packit Service 20376f
 *
Packit Service 20376f
 * @param array git_strarray from which to free string data
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(void) git_strarray_free(git_strarray *array);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Copy a string array object from source to target.
Packit Service 20376f
 *
Packit Service 20376f
 * Note: target is overwritten and hence should be empty, otherwise its
Packit Service 20376f
 * contents are leaked.  Call git_strarray_free() if necessary.
Packit Service 20376f
 *
Packit Service 20376f
 * @param tgt target
Packit Service 20376f
 * @param src source
Packit Service 20376f
 * @return 0 on success, < 0 on allocation failure
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_strarray_copy(git_strarray *tgt, const git_strarray *src);
Packit Service 20376f
Packit Service 20376f
Packit Service 20376f
/** @} */
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
Packit Service 20376f
#endif
Packit Service 20376f