Coverage Report

Created: 2025-06-13 06:36

/src/util-linux/include/strv.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * SPDX-License-Identifier: LGPL-2.1-or-later
3
 */
4
#ifndef UTIL_LINUX_STRV
5
#define UTIL_LINUX_STRV
6
7
#include <stdarg.h>
8
9
#include "c.h"
10
11
char **strv_free(char **l);
12
void strv_clear(char **l);
13
char **strv_copy(char * const *l);
14
unsigned strv_length(char * const *l);
15
16
int strv_extend_strv(char ***a, char **b);
17
int strv_extend_strv_concat(char ***a, char **b, const char *suffix);
18
int strv_extend(char ***l, const char *value);
19
20
int strv_extendv(char ***l, const char *format, va_list ap)
21
    __attribute__ ((__format__ (__printf__, 2, 0)));
22
int strv_extendf(char ***l, const char *format, ...)
23
    __attribute__ ((__format__ (__printf__, 2, 3)));
24
25
int strv_push(char ***l, char *value);
26
int strv_push_prepend(char ***l, char *value);
27
int strv_consume(char ***l, char *value);
28
int strv_consume_prepend(char ***l, char *value);
29
30
char **strv_remove(char **l, const char *s);
31
32
char **strv_new(const char *x, ...);
33
34
0
static inline const char* STRV_IFNOTNULL(const char *x) {
35
0
        return x ? x : (const char *) -1;
36
0
}
Unexecuted instantiation: env.c:STRV_IFNOTNULL
Unexecuted instantiation: strv.c:STRV_IFNOTNULL
37
38
0
static inline int strv_isempty(char * const *l) {
39
0
        return !l || !*l;
40
0
}
Unexecuted instantiation: env.c:strv_isempty
Unexecuted instantiation: strv.c:strv_isempty
41
42
char **strv_split(const char *s, const char *separator);
43
char *strv_join(char **l, const char *separator);
44
45
#define STRV_FOREACH(s, l)                      \
46
0
        for ((s) = (l); (s) && *(s); (s)++)
47
48
#define STRV_FOREACH_BACKWARDS(s, l)            \
49
        STRV_FOREACH(s, l)                      \
50
                ;                               \
51
        for ((s)--; (l) && ((s) >= (l)); (s)--)
52
53
54
#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
55
56
char **strv_reverse(char **l);
57
58
#endif /* UTIL_LINUX_STRV */
59
60