Merge pull request #24058 from qdeslandes/journald_regex_filtering

Allow for journald logs filtering on a per-unit basis
This commit is contained in:
Yu Watanabe
2022-12-15 22:03:33 +09:00
committed by GitHub
30 changed files with 663 additions and 1 deletions
+15
View File
@@ -115,6 +115,21 @@ int strv_make_nulstr(char * const *l, char **ret, size_t *ret_size) {
return 0;
}
int set_make_nulstr(Set *s, char **ret, size_t *ret_size) {
/* Use _cleanup_free_ instead of _cleanup_strv_free_ because we need to clean the strv only, not
* the strings owned by the set. */
_cleanup_free_ char **strv = NULL;
assert(ret);
assert(ret_size);
strv = set_get_strv(s);
if (!strv)
return -ENOMEM;
return strv_make_nulstr(strv, ret, ret_size);
}
const char* nulstr_get(const char *nulstr, const char *needle) {
if (!nulstr)
return NULL;
+3
View File
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <string.h>
#include "set.h"
#define NULSTR_FOREACH(i, l) \
for (typeof(*(l)) *(i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
@@ -21,6 +23,7 @@ static inline bool nulstr_contains(const char *nulstr, const char *needle) {
char** strv_parse_nulstr(const char *s, size_t l);
char** strv_split_nulstr(const char *s);
int strv_make_nulstr(char * const *l, char **p, size_t *n);
int set_make_nulstr(Set *s, char **ret, size_t *ret_size);
static inline int strv_from_nulstr(char ***ret, const char *nulstr) {
char **t;