Coverage Report

Created: 2025-07-11 06:18

/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 **ul_strv_free(char **l);
12
char **ul_strv_copy(char * const *l);
13
unsigned ul_strv_length(char * const *l);
14
15
int ul_strv_extend_strv(char ***a, char **b);
16
int ul_strv_extend_strv_concat(char ***a, char **b, const char *suffix);
17
int ul_strv_extend(char ***l, const char *value);
18
19
int ul_strv_extendv(char ***l, const char *format, va_list ap)
20
    __attribute__ ((__format__ (__printf__, 2, 0)));
21
int ul_strv_extendf(char ***l, const char *format, ...)
22
    __attribute__ ((__format__ (__printf__, 2, 3)));
23
24
int ul_strv_push(char ***l, char *value);
25
int ul_strv_push_prepend(char ***l, char *value);
26
int ul_strv_consume(char ***l, char *value);
27
int ul_strv_consume_prepend(char ***l, char *value);
28
29
char **ul_strv_remove(char **l, const char *s);
30
31
char **ul_strv_new(const char *x, ...);
32
33
0
static inline const char* UL_STRV_IFNOTNULL(const char *x) {
34
0
        return x ? x : (const char *) -1;
35
0
}
Unexecuted instantiation: env.c:UL_STRV_IFNOTNULL
Unexecuted instantiation: strv.c:UL_STRV_IFNOTNULL
36
37
0
static inline int ul_strv_isempty(char * const *l) {
38
0
        return !l || !*l;
39
0
}
Unexecuted instantiation: env.c:ul_strv_isempty
Unexecuted instantiation: strv.c:ul_strv_isempty
40
41
char **ul_strv_split(const char *s, const char *separator);
42
char *ul_strv_join(char **l, const char *separator);
43
44
#define UL_STRV_FOREACH(s, l)                      \
45
0
        for ((s) = (l); (s) && *(s); (s)++)
46
47
#define UL_STRV_FOREACH_BACKWARDS(s, l)            \
48
        UL_STRV_FOREACH(s, l)                      \
49
                ;                               \
50
        for ((s)--; (l) && ((s) >= (l)); (s)--)
51
52
53
#define UL_STRV_MAKE_EMPTY ((char*[1]) { NULL })
54
55
char **ul_strv_reverse(char **l);
56
57
#endif /* UTIL_LINUX_STRV */
58
59