Merge pull request #19514 from keszybz/return-UnitNameFlags-more

Return UnitNameFlags from unit_name_to_instance()
This commit is contained in:
Yu Watanabe
2021-05-06 12:46:00 +09:00
committed by GitHub
6 changed files with 16 additions and 18 deletions
+4 -6
View File
@@ -1278,8 +1278,8 @@ int get_timezones(char ***ret) {
f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
if (f) {
for (;;) {
_cleanup_free_ char *line = NULL;
char *p, *w;
_cleanup_free_ char *line = NULL, *w = NULL;
char *p;
size_t k;
r = read_line(f, LONG_LINE_MAX, &line);
@@ -1310,12 +1310,10 @@ int get_timezones(char ***ret) {
if (!w)
return -ENOMEM;
if (!GREEDY_REALLOC(zones, n_allocated, n_zones + 2)) {
free(w);
if (!GREEDY_REALLOC(zones, n_allocated, n_zones + 2))
return -ENOMEM;
}
zones[n_zones++] = w;
zones[n_zones++] = TAKE_PTR(w);
zones[n_zones] = NULL;
}
+1 -1
View File
@@ -72,7 +72,7 @@ int unit_validate_alias_symlink_and_warn(const char *filename, const char *targe
const char *src, *dst;
_cleanup_free_ char *src_instance = NULL, *dst_instance = NULL;
UnitType src_unit_type, dst_unit_type;
int src_name_type, dst_name_type;
UnitNameFlags src_name_type, dst_name_type;
/* Check if the *alias* symlink is valid. This applies to symlinks like
* /etc/systemd/system/dbus.service → dbus-broker.service, but not to .wants or .requires symlinks
+1 -1
View File
@@ -139,7 +139,7 @@ int unit_name_to_prefix(const char *n, char **ret) {
return 0;
}
int unit_name_to_instance(const char *n, char **ret) {
UnitNameFlags unit_name_to_instance(const char *n, char **ret) {
const char *p, *d;
assert(n);
+2 -2
View File
@@ -22,8 +22,8 @@ bool unit_instance_is_valid(const char *i) _pure_;
bool unit_suffix_is_valid(const char *s) _pure_;
int unit_name_to_prefix(const char *n, char **ret);
int unit_name_to_instance(const char *n, char **ret);
static inline int unit_name_classify(const char *n) {
UnitNameFlags unit_name_to_instance(const char *n, char **ret);
static inline UnitNameFlags unit_name_classify(const char *n) {
return unit_name_to_instance(n, NULL);
}
int unit_name_to_prefix_and_instance(const char *n, char **ret);