char cache_path[PATH_MAX];
const char* name = pakfire_package_get_name(pkg);
- pakfire_make_cache_path(pakfire, cache_path, sizeof(cache_path) - 1,
- "sources/%s/%s", name, filename);
+ pakfire_make_cache_path(pakfire, cache_path, "sources/%s/%s", name, filename);
// Download the file if it does not exist in the cache
if (access(cache_path, R_OK) != 0) {
#include <solv/pool.h>
-int pakfire_make_cache_path(Pakfire pakfire, char* path, size_t length,
- const char* format, ...)
- __attribute__((format(printf, 4, 5)));
+#define pakfire_make_cache_path(pakfire, path, format, ...) \
+ __pakfire_make_cache_path(pakfire, path, sizeof(path) - 1, format, __VA_ARGS__)
+
+int __pakfire_make_cache_path(Pakfire pakfire, char* path, size_t length,
+ const char* format, ...) __attribute__((format(printf, 4, 5)));
void pakfire_pool_has_changed(Pakfire pakfire);
void pakfire_pool_apply_changes(Pakfire pakfire);
if (strlen(checksum) < 3)
return NULL;
- pakfire_make_cache_path(pkg->pakfire, path, sizeof(path) - 1,
+ pakfire_make_cache_path(pkg->pakfire, path,
"%c%c/%s/%s", checksum[0], checksum[1], checksum + 2, filename);
return strdup(path);
// Cache
-int pakfire_make_cache_path(Pakfire pakfire, char* path, size_t length,
+int __pakfire_make_cache_path(Pakfire pakfire, char* path, size_t length,
const char* format, ...) {
va_list args;
PAKFIRE_EXPORT int pakfire_cache_destroy(Pakfire pakfire, const char* path) {
char cache_path[PATH_MAX];
- pakfire_make_cache_path(pakfire, cache_path, sizeof(cache_path) - 1, "%s", path);
+ pakfire_make_cache_path(pakfire, cache_path, "%s", path);
// Completely delete the tree of files
return pakfire_rmtree(cache_path, 0);
// Try loading the database
if (*database_filename) {
- pakfire_make_cache_path(repo->pakfire, database_cache_path, sizeof(database_cache_path) -1,
+ pakfire_make_cache_path(repo->pakfire, database_cache_path,
"repodata/%s/%s", pakfire_repo_get_name(repo), database_filename);
// Download the database if necessary
return repo;
// Make path to mirrorlist
- r = pakfire_make_cache_path(pakfire, repo->appdata->mirrorlist, sizeof(repo->appdata->mirrorlist) - 1,
+ r = pakfire_make_cache_path(pakfire, repo->appdata->mirrorlist,
"repodata/%s/mirrorlist", pakfire_repo_get_name(repo));
if (r < 0)
goto ERROR;
// Make path for metadata
- r = pakfire_make_cache_path(pakfire, repo->appdata->metadata, sizeof(repo->appdata->metadata) - 1,
+ r = pakfire_make_cache_path(pakfire, repo->appdata->metadata,
"repodata/%s/repomd.json", pakfire_repo_get_name(repo));
if (r < 0)
goto ERROR;
PAKFIRE_EXPORT int pakfire_repo_clean(PakfireRepo repo) {
char cache_path[PATH_MAX];
- int r = pakfire_make_cache_path(repo->pakfire, cache_path, sizeof(cache_path) - 1,
+ int r = pakfire_make_cache_path(repo->pakfire, cache_path,
"%s", pakfire_repo_get_name(repo));
if (r < 0)
return r;