mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 11:55:23 +03:00
util: add chars_intersect() call
This commit is contained in:
parent
ee9b5e0118
commit
db12775d59
11
util.c
11
util.c
@ -1193,6 +1193,17 @@ finish:
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool chars_intersect(const char *a, const char *b) {
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
/* Returns true if any of the chars in a are in b. */
|
||||||
|
for (p = a; *p; p++)
|
||||||
|
if (strchr(b, *p))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const ioprio_class_table[] = {
|
static const char *const ioprio_class_table[] = {
|
||||||
[IOPRIO_CLASS_NONE] = "none",
|
[IOPRIO_CLASS_NONE] = "none",
|
||||||
[IOPRIO_CLASS_RT] = "realtime",
|
[IOPRIO_CLASS_RT] = "realtime",
|
||||||
|
2
util.h
2
util.h
@ -157,6 +157,8 @@ char *bus_path_unescape(const char *s);
|
|||||||
|
|
||||||
bool ignore_file(const char *filename);
|
bool ignore_file(const char *filename);
|
||||||
|
|
||||||
|
bool chars_intersect(const char *a, const char *b);
|
||||||
|
|
||||||
#define DEFINE_STRING_TABLE_LOOKUP(name,type) \
|
#define DEFINE_STRING_TABLE_LOOKUP(name,type) \
|
||||||
const char *name##_to_string(type i) { \
|
const char *name##_to_string(type i) { \
|
||||||
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
|
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
|
||||||
|
Loading…
Reference in New Issue
Block a user