va_start(args, url);
// Create a new xfer
- r = __pakfire_xfer_create(&x, service->ctx, url, args);
+ r = pakfire_xfer_create(&x, service->ctx, url, args);
if (r < 0)
goto ERROR;
}
static int pakfire_daemon_xfer_create(struct pakfire_xfer** xfer,
- struct pakfire_daemon* daemon, const char* url) {
+ struct pakfire_daemon* daemon, const char* url, ...) {
struct pakfire_xfer* x = NULL;
+ va_list args;
int r;
+ va_start(args, url);
+
// Create a new xfer
- r = pakfire_xfer_create(&x, daemon->ctx, "%s", url);
+ r = pakfire_xfer_create(&x, daemon->ctx, url, args);
if (r < 0)
goto ERROR;
ERROR:
if (x)
pakfire_xfer_unref(x);
+ va_end(args);
return r;
}
}
static int pakfire_dist_download_source(struct pakfire_ctx* ctx,
- struct pakfire_mirrorlist* mirrorlist, const char* filename, const char* cache_path) {
+ struct pakfire_mirrorlist* mirrorlist, const char* cache_path, const char* filename, ...) {
struct pakfire_xfer* xfer = NULL;
+ va_list args;
int r;
// Do not download if the file exists
if (pakfire_path_exists(cache_path))
return 0;
+ va_start(args, filename);
+
// Create a new transfer
- r = pakfire_xfer_create(&xfer, ctx, "%s", filename);
+ r = pakfire_xfer_create(&xfer, ctx, filename, args);
if (r)
goto ERROR;
ERROR:
if (xfer)
pakfire_xfer_unref(xfer);
+ va_end(args);
return r;
}
return r;
// Download the source file
- r = pakfire_dist_download_source(ctx, mirrorlist, filename, cache_path);
+ r = pakfire_dist_download_source(ctx, mirrorlist, cache_path, "%s", filename);
if (r)
return r;
PAKFIRE_METHOD_DELETE,
} pakfire_xfer_method_t;
-int pakfire_xfer_create(struct pakfire_xfer** transfer, struct pakfire_ctx* ctx,
- const char* url, ...) __attribute__((format(printf, 3, 4)));
-int __pakfire_xfer_create(struct pakfire_xfer** xfer, struct pakfire_ctx* ctx,
+int pakfire_xfer_create(struct pakfire_xfer** xfer, struct pakfire_ctx* ctx,
const char* url, va_list args) __attribute__((format(printf, 3, 0)));
struct pakfire_xfer* pakfire_xfer_ref(struct pakfire_xfer* xfer);
va_start(args, url);
// Create a new xfer
- r = __pakfire_xfer_create(&x, job->ctx, url, args);
+ r = pakfire_xfer_create(&x, job->ctx, url, args);
if (r < 0)
goto ERROR;
settings of this repository.
*/
static int pakfire_repo_xfer_create(
- struct pakfire_xfer** xfer, struct pakfire_repo* repo, const char* url) {
+ struct pakfire_xfer** xfer, struct pakfire_repo* repo, const char* url, ...) {
struct pakfire_mirrorlist* mirrorlist = NULL;
const char* baseurl = NULL;
+ va_list args;
int r;
+ va_start(args, url);
+
// Create a new transfer
- r = pakfire_xfer_create(xfer, repo->ctx, "%s", url);
+ r = pakfire_xfer_create(xfer, repo->ctx, url, args);
if (r < 0)
goto ERROR;
if (*xfer)
pakfire_xfer_unref(*xfer);
}
+ va_end(args);
return r;
}
const char* filename, const char* path) {
struct pakfire_xfer* xfer = NULL;
char title[NAME_MAX];
- char url[PATH_MAX];
int r;
// Do nothing if the file already exists
if (r)
return r;
- // Make download URL
- r = pakfire_string_format(url, "repodata/%s", filename);
- if (r)
- return r;
-
// Create a new transfer
- r = pakfire_repo_xfer_create(&xfer, repo, url);
+ r = pakfire_repo_xfer_create(&xfer, repo, "repodata/%s", filename);
if (r)
goto ERROR;
}
// Create a new xfer
- r = pakfire_repo_xfer_create(&xfer, repo, url);
+ r = pakfire_repo_xfer_create(&xfer, repo, "%s", url);
if (r)
goto ERROR;
}
// Create a new transfer
- r = pakfire_repo_xfer_create(&x, repo, url);
+ r = pakfire_repo_xfer_create(&x, repo, "%s", url);
if (r)
goto ERROR;
}
// Create a new transfer
- r = pakfire_repo_xfer_create(&xfer, repo, url);
+ r = pakfire_repo_xfer_create(&xfer, repo, "%s", url);
if (r)
goto ERROR;
}
int pakfire_xfer_create(struct pakfire_xfer** xfer,
- struct pakfire_ctx* ctx, const char* url, ...) {
- va_list args;
- int r;
-
- va_start(args, url);
- r = __pakfire_xfer_create(xfer, ctx, url, args);
- va_end(args);
-
- return r;
-}
-
-int __pakfire_xfer_create(struct pakfire_xfer** xfer,
struct pakfire_ctx* ctx, const char* url, va_list args) {
struct pakfire_xfer* x = NULL;
char buffer[PATH_MAX];