#include <libintl.h>
#define _(String) gettext(String)
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct bpph **get_bpph_list(const char *archive_url, const char *pkg_status)
{
- struct json_object *o_next;
- char *url;
- json_object *o;
- void **result = NULL;
+ char *url, *bpph_key;
+ struct bpph **result = NULL;
+ struct json_object *o, *bpph_json, *o_next;
url = malloc(strlen(archive_url)+
strlen(QUERY_GET_PUBLISHED_BINARIES)+
if (!o)
break;
- result = list_append_list(result,
- (void **)json_object_to_bpph_list(o));
+ result = (struct bpph **)list_append_list
+ ((void **)result,
+ (void **)json_object_to_bpph_list(o));
o_next = json_object_object_get(o, "next_collection_link");
json_object_put(o);
}
- return (struct bpph **)result;
+ bpph_json = bpph_list_to_json(result);
+
+ bpph_key = malloc(strlen(archive_url + 7) + strlen("/bpph") + 1);
+ sprintf(bpph_key, "%s/bpph", archive_url + 7);
+ fcache_put(bpph_key, json_object_to_json_string(bpph_json));
+
+ json_object_put(bpph_json);
+ free(bpph_key);
+
+ return result;
}
int get_download_count(const char *archive_url)