summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-17 15:56:46 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-18 23:38:22 -0400
commit795ff6d5d827eb5743d9e37c4acaee4bdeff58b4 (patch)
tree9d68e9b15ba6748dc2dc25f6f1395f231ef7b241 /src/shared
parent596fc2636a898c0948cb9d2b3d3e7972084bc992 (diff)
shared/install: add helper function unit_file_changes_have_modification()
As suggested in review of #3049.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/install.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/shared/install.h b/src/shared/install.h
index 99cd1409f3..219b48f428 100644
--- a/src/shared/install.h
+++ b/src/shared/install.h
@@ -77,16 +77,20 @@ enum UnitFileChangeType {
_UNIT_FILE_CHANGE_TYPE_INVALID = -1
};
-static inline bool unit_file_change_is_modification(UnitFileChangeType type) {
- return IN_SET(type, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK);
-}
-
struct UnitFileChange {
UnitFileChangeType type;
char *path;
char *source;
};
+static inline bool unit_file_changes_have_modification(const UnitFileChange* changes, unsigned n_changes) {
+ unsigned i;
+ for (i = 0; i < n_changes; i++)
+ if (IN_SET(changes[i].type, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK))
+ return true;
+ return false;
+}
+
struct UnitFileList {
char *path;
UnitFileState state;