argpar: sync with upstream - adjust to iterator API
[lttng-tools.git] / src / common / string-utils / string-utils.h
CommitLineData
9c55c241 1/*
ab5be9fa 2 * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
9c55c241 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
9c55c241 5 *
9c55c241
PP
6 */
7
8#ifndef _STRING_UTILS_H
9#define _STRING_UTILS_H
10
11#include <stdbool.h>
f181fa5a 12#include <common/macros.h>
f78de773 13#include <common/dynamic-array.h>
9c55c241 14
f181fa5a 15LTTNG_HIDDEN
9c55c241 16void strutils_normalize_star_glob_pattern(char *pattern);
f181fa5a
JG
17
18LTTNG_HIDDEN
9c55c241 19bool strutils_is_star_glob_pattern(const char *pattern);
f181fa5a
JG
20
21LTTNG_HIDDEN
9c55c241 22bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern);
f181fa5a
JG
23
24LTTNG_HIDDEN
9c55c241 25char *strutils_unescape_string(const char *input, char only_char);
f181fa5a
JG
26
27LTTNG_HIDDEN
f78de773
JG
28int strutils_split(const char *input, char delim, bool escape_delim,
29 struct lttng_dynamic_pointer_array *out_strings);
f181fa5a
JG
30
31LTTNG_HIDDEN
9c55c241 32void strutils_free_null_terminated_array_of_strings(char **array);
f181fa5a
JG
33
34LTTNG_HIDDEN
9c55c241
PP
35size_t strutils_array_of_strings_len(char * const *array);
36
5b770521
SM
37/*
38 * Append `append` to the malloc-end string `str`.
39 *
40 * On success, `str` is free'd (if not NULL) and assigned a new malloc-ed
41 * string. On failure, `str` is not modified.
42 *
43 * Return 0 on success, -ENOMEM on failure.
44 */
45LTTNG_HIDDEN
46int strutils_append_str(char **str, const char *append);
47
ea76a8bb
SM
48/*
49 * Like `strutils_append_str`, but the appended string is formatted using
50 * `fmt` and the following arguments.
51 */
52LTTNG_HIDDEN
53int strutils_appendf(char **s, const char *fmt, ...);
54
9c55c241 55#endif /* _STRING_UTILS_H */
This page took 0.040191 seconds and 4 git commands to generate.