static int pakfire_dist_create_downloader_and_mirrorlist(
struct pakfire* pakfire, struct pakfire_parser* makefile,
struct pakfire_downloader** downloader, struct pakfire_mirrorlist** mirrorlist) {
+ char* p = NULL;
+
// Create the downloader
int r = pakfire_downloader_create(downloader, pakfire);
if (r) {
}
// Fetch source_dl
- char** source_dls = pakfire_parser_get_split(makefile, NULL, "source_dl", ' ');
+ char* source_dl = pakfire_parser_get(makefile, NULL, "source_dl");
// We do not need to create a mirrorlist if this isn't set
- if (!source_dls)
+ if (!source_dl)
return 0;
// Create mirrorlist
}
// Add all mirrors
- for (char** source_dl = source_dls; *source_dl; source_dl++) {
- r = pakfire_mirrorlist_add_mirror(*mirrorlist, *source_dl);
+ const char* mirror = strtok_r(source_dl, " ", &p);
+
+ while (mirror) {
+ r = pakfire_mirrorlist_add_mirror(*mirrorlist, mirror);
if (r)
goto ERROR;
+
+ mirror = strtok_r(NULL, " ", &p);
}
// Success
r = 0;
ERROR:
- if (source_dls) {
- for (char** source_dl = source_dls; *source_dl; source_dl++)
- free(*source_dl);
- free(source_dls);
- }
+ if (source_dl)
+ free(source_dl);
return r;
}