summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-02-03 02:05:59 +0100
committerLennart Poettering <lennart@poettering.net>2015-02-03 02:05:59 +0100
commit63c372cb9df3bee01e3bf8cd7f96f336bddda846 (patch)
treebf4d1b6e41f72927a2b58e7dd21daa0c496aaa96 /src/import
parent44de0efc6e406515fc1cf8b95d9655d0d7f7ffff (diff)
util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
Diffstat (limited to 'src/import')
-rw-r--r--src/import/curl-util.c2
-rw-r--r--src/import/import-common.c4
-rw-r--r--src/import/import-dkr.c14
-rw-r--r--src/import/import-raw.c2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/import/curl-util.c b/src/import/curl-util.c
index 313b04b0b8..d390cfb1f3 100644
--- a/src/import/curl-util.c
+++ b/src/import/curl-util.c
@@ -303,7 +303,7 @@ int curl_glue_make(CURL **ret, const char *url, void *userdata) {
goto fail;
}
- useragent = strappenda(program_invocation_short_name, "/" PACKAGE_VERSION);
+ useragent = strjoina(program_invocation_short_name, "/" PACKAGE_VERSION);
if (curl_easy_setopt(c, CURLOPT_USERAGENT, useragent) != CURLE_OK) {
r = -EIO;
goto fail;
diff --git a/src/import/import-common.c b/src/import/import-common.c
index e5531b89c5..2acf380f99 100644
--- a/src/import/import-common.c
+++ b/src/import/import-common.c
@@ -121,7 +121,7 @@ int import_make_local_copy(const char *final, const char *image_root, const char
if (!image_root)
image_root = "/var/lib/machines";
- p = strappenda(image_root, "/", local);
+ p = strjoina(image_root, "/", local);
if (force_local) {
(void) btrfs_subvol_remove(p);
@@ -309,7 +309,7 @@ int import_verify(
return -EBADMSG;
}
- line = strappenda(main_job->checksum, " *", fn, "\n");
+ line = strjoina(main_job->checksum, " *", fn, "\n");
p = memmem(checksum_job->payload,
checksum_job->payload_size,
diff --git a/src/import/import-dkr.c b/src/import/import-dkr.c
index a4ff6f43f0..fb72f6cee3 100644
--- a/src/import/import-dkr.c
+++ b/src/import/import-dkr.c
@@ -399,7 +399,7 @@ static int dkr_import_add_token(DkrImport *i, ImportJob *j) {
assert(j);
if (i->response_token)
- t = strappenda("Authorization: Token ", i->response_token);
+ t = strjoina("Authorization: Token ", i->response_token);
else
t = HEADER_TOKEN " true";
@@ -480,7 +480,7 @@ static int dkr_import_job_on_open_disk(ImportJob *j) {
if (base) {
const char *base_path;
- base_path = strappenda(i->image_root, "/.dkr-", base);
+ base_path = strjoina(i->image_root, "/.dkr-", base);
r = btrfs_subvol_snapshot(base_path, i->temp_path, false, true);
} else
r = btrfs_subvol_make(i->temp_path);
@@ -549,7 +549,7 @@ static int dkr_import_pull_layer(DkrImport *i) {
i->final_path = path;
path = NULL;
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", layer, "/layer");
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", layer, "/layer");
r = import_job_new(&i->layer_job, url, i->glue, i);
if (r < 0)
return log_error_errno(r, "Failed to allocate layer job: %m");
@@ -610,7 +610,7 @@ static void dkr_import_job_on_finished(ImportJob *j) {
log_info("Index lookup succeeded, directed to registry %s.", i->response_registries[0]);
dkr_import_report_progress(i, DKR_RESOLVING);
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/repositories/", i->name, "/tags/", i->tag);
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/repositories/", i->name, "/tags/", i->tag);
r = import_job_new(&i->tags_job, url, i->glue, i);
if (r < 0) {
log_error_errno(r, "Failed to allocate tags job: %m");
@@ -652,7 +652,7 @@ static void dkr_import_job_on_finished(ImportJob *j) {
log_info("Tag lookup succeeded, resolved to layer %s.", i->id);
dkr_import_report_progress(i, DKR_METADATA);
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/ancestry");
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/ancestry");
r = import_job_new(&i->ancestry_job, url, i->glue, i);
if (r < 0) {
log_error_errno(r, "Failed to allocate ancestry job: %m");
@@ -668,7 +668,7 @@ static void dkr_import_job_on_finished(ImportJob *j) {
i->ancestry_job->on_finished = dkr_import_job_on_finished;
i->ancestry_job->on_progress = dkr_import_job_on_progress;
- url = strappenda(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/json");
+ url = strjoina(PROTOCOL_PREFIX, i->response_registries[0], "/v1/images/", i->id, "/json");
r = import_job_new(&i->json_job, url, i->glue, i);
if (r < 0) {
log_error_errno(r, "Failed to allocate json job: %m");
@@ -873,7 +873,7 @@ int dkr_import_pull(DkrImport *i, const char *name, const char *tag, const char
if (r < 0)
return r;
- url = strappenda(i->index_url, "/v1/repositories/", name, "/images");
+ url = strjoina(i->index_url, "/v1/repositories/", name, "/images");
r = import_job_new(&i->images_job, url, i->glue, i);
if (r < 0)
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index 5c88cdb007..8d99f1085c 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -270,7 +270,7 @@ static int raw_import_make_local_copy(RawImport *i) {
return log_error_errno(errno, "Failed to seek to beginning of vendor image: %m");
}
- p = strappenda(i->image_root, "/", i->local, ".raw");
+ p = strjoina(i->image_root, "/", i->local, ".raw");
if (i->force_local) {
(void) btrfs_subvol_remove(p);