mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
basic: add new helper call empty_or_dash_to_null()
We have a function like this at two places already. Let's unify it in one generic location and let's port a number of users over.
This commit is contained in:
@@ -63,6 +63,10 @@ static inline bool empty_or_dash(const char *str) {
|
||||
(str[0] == '-' && str[1] == 0);
|
||||
}
|
||||
|
||||
static inline const char *empty_or_dash_to_null(const char *p) {
|
||||
return empty_or_dash(p) ? NULL : p;
|
||||
}
|
||||
|
||||
static inline char *startswith(const char *s, const char *prefix) {
|
||||
size_t l;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user