summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-04-08 12:03:33 +0200
committerLennart Poettering <lennart@poettering.net>2019-04-08 12:03:33 +0200
commite7b88b7bc1b33af3966349ca59ecd3d25c3e8504 (patch)
treed0ebd1d919bca2916a84c89351b77007ad30ec46 /src/import
parentea505047c542ee0a6d242c9c1bb6683b553b58db (diff)
downloadsystemd-e7b88b7bc1b33af3966349ca59ecd3d25c3e8504.tar.gz
tree-wide: introduce empty_or_dash() helper
At quite a few places we check isempty() || streq(…, "-"), let's add a helper to simplify that, and replace that by a single function call.
Diffstat (limited to 'src/import')
-rw-r--r--src/import/export.c4
-rw-r--r--src/import/import-fs.c4
-rw-r--r--src/import/import.c8
-rw-r--r--src/import/pull.c4
4 files changed, 10 insertions, 10 deletions
diff --git a/src/import/export.c b/src/import/export.c
index 4566a66a15..ffd9347e92 100644
--- a/src/import/export.c
+++ b/src/import/export.c
@@ -78,7 +78,7 @@ static int export_tar(int argc, char *argv[], void *userdata) {
if (argc >= 3)
path = argv[2];
- if (isempty(path) || streq(path, "-"))
+ if (empty_or_dash(path))
path = NULL;
determine_compression_from_filename(path);
@@ -155,7 +155,7 @@ static int export_raw(int argc, char *argv[], void *userdata) {
if (argc >= 3)
path = argv[2];
- if (isempty(path) || streq(path, "-"))
+ if (empty_or_dash(path))
path = NULL;
determine_compression_from_filename(path);
diff --git a/src/import/import-fs.c b/src/import/import-fs.c
index 974c0f5536..9f3ef0826c 100644
--- a/src/import/import-fs.c
+++ b/src/import/import-fs.c
@@ -117,14 +117,14 @@ static int import_fs(int argc, char *argv[], void *userdata) {
if (argc >= 2)
path = argv[1];
- if (isempty(path) || streq(path, "-"))
+ if (empty_or_dash(path))
path = NULL;
if (argc >= 3)
local = argv[2];
else if (path)
local = basename(path);
- if (isempty(local) || streq(local, "-"))
+ if (empty_or_dash(local))
local = NULL;
if (local) {
diff --git a/src/import/import.c b/src/import/import.c
index e3a1ae8a8b..4c9603fbdc 100644
--- a/src/import/import.c
+++ b/src/import/import.c
@@ -49,14 +49,14 @@ static int import_tar(int argc, char *argv[], void *userdata) {
if (argc >= 2)
path = argv[1];
- if (isempty(path) || streq(path, "-"))
+ if (empty_or_dash(path))
path = NULL;
if (argc >= 3)
local = argv[2];
else if (path)
local = basename(path);
- if (isempty(local) || streq(local, "-"))
+ if (empty_or_dash(local))
local = NULL;
if (local) {
@@ -145,14 +145,14 @@ static int import_raw(int argc, char *argv[], void *userdata) {
if (argc >= 2)
path = argv[1];
- if (isempty(path) || streq(path, "-"))
+ if (empty_or_dash(path))
path = NULL;
if (argc >= 3)
local = argv[2];
else if (path)
local = basename(path);
- if (isempty(local) || streq(local, "-"))
+ if (empty_or_dash(local))
local = NULL;
if (local) {
diff --git a/src/import/pull.c b/src/import/pull.c
index 68b1221b72..6342f7d7f1 100644
--- a/src/import/pull.c
+++ b/src/import/pull.c
@@ -64,7 +64,7 @@ static int pull_tar(int argc, char *argv[], void *userdata) {
local = l;
}
- if (isempty(local) || streq(local, "-"))
+ if (empty_or_dash(local))
local = NULL;
if (local) {
@@ -151,7 +151,7 @@ static int pull_raw(int argc, char *argv[], void *userdata) {
local = l;
}
- if (isempty(local) || streq(local, "-"))
+ if (empty_or_dash(local))
local = NULL;
if (local) {