__pakfire_string_format(s, sizeof(s), format, __VA_ARGS__)
int __pakfire_string_format(char* s, const size_t length,
const char* format, ...) __attribute__((format(printf, 3, 4)));
+
+#define pakfire_string_vformat(s, format, args) \
+ __pakfire_string_vformat(s, sizeof(s), format, args)
int __pakfire_string_vformat(char* s, const size_t length,
const char* format, va_list args) __attribute__((format(printf, 3, 0)));
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];
int r;
// Fail if the context is flagged as offline
return -EPERM;
}
- // Format the URL
- r = __pakfire_string_vformat(buffer, sizeof(buffer), url, args);
- if (r < 0)
- return r;
-
// Allocate a new xfer
x = calloc(1, sizeof(*x));
if (!x)
x->nrefs = 1;
// Store the URL
- r = pakfire_string_set(x->url, buffer);
+ r = pakfire_string_vformat(x->url, url, args);
if (r)
goto ERROR;