Relicence all source and header files included in LGPL code
[lttng-tools.git] / src / common / string-utils / string-utils.h
... / ...
CommitLineData
1/*
2 * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef _STRING_UTILS_H
9#define _STRING_UTILS_H
10
11#include <stdbool.h>
12#include <common/macros.h>
13#include <common/dynamic-array.h>
14
15void strutils_normalize_star_glob_pattern(char *pattern);
16
17bool strutils_is_star_glob_pattern(const char *pattern);
18
19bool strutils_is_star_at_the_end_only_glob_pattern(const char *pattern);
20
21char *strutils_unescape_string(const char *input, char only_char);
22
23int strutils_split(const char *input, char delim, bool escape_delim,
24 struct lttng_dynamic_pointer_array *out_strings);
25
26void strutils_free_null_terminated_array_of_strings(char **array);
27
28size_t strutils_array_of_strings_len(char * const *array);
29
30/*
31 * Append `append` to the malloc-end string `str`.
32 *
33 * On success, `str` is free'd (if not NULL) and assigned a new malloc-ed
34 * string. On failure, `str` is not modified.
35 *
36 * Return 0 on success, -ENOMEM on failure.
37 */
38C_LINKAGE int strutils_append_str(char **str, const char *append);
39
40/*
41 * Like `strutils_append_str`, but the appended string is formatted using
42 * `fmt` and the following arguments.
43 */
44C_LINKAGE ATTR_FORMAT_PRINTF(2, 3)
45int strutils_appendf(char **s, const char *fmt, ...);
46
47#endif /* _STRING_UTILS_H */
This page took 0.022327 seconds and 4 git commands to generate.