summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barker <paul@paulbarker.me.uk>2013-11-20 10:24:49 (EST)
committer Paul Barker <paul@paulbarker.me.uk>2013-12-17 16:00:35 (EST)
commit93b7bcd9335071c85d0353d541d4ff72743333ea (patch)
treeb6bec5174ba8a6e1c53afe0fb40a011c64dcd850
parent9f98bfc87b6f059db134d9bc382922a9c6ccb744 (diff)
opkg_download: Drop config check from header
The function 'opkg_curl_cleanup' is unconditionally defined in the header and is implemented as an empty stub in the source file if curl is not enabled. This allows us to present a consistent API regardless of the configure options used to build opkg. Signed-off-by: Paul Barker <paul@paulbarker.me.uk> Cc: Carsten Schoenert <c.schoenert@gmail.com>
-rw-r--r--libopkg/opkg_download.c4
-rw-r--r--libopkg/opkg_download.h9
2 files changed, 10 insertions, 3 deletions
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
index e53e64e..cda5ae8 100644
--- a/libopkg/opkg_download.c
+++ b/libopkg/opkg_download.c
@@ -555,14 +555,16 @@ end:
#endif
-#ifdef HAVE_CURL
void opkg_curl_cleanup(void){
+#ifdef HAVE_CURL
if(curl != NULL){
curl_easy_cleanup (curl);
curl = NULL;
}
+#endif
}
+#ifdef HAVE_CURL
static CURL *
opkg_curl_init(curl_progress_func cb, void *data)
{
diff --git a/libopkg/opkg_download.h b/libopkg/opkg_download.h
index 91b990e..39340ea 100644
--- a/libopkg/opkg_download.h
+++ b/libopkg/opkg_download.h
@@ -33,7 +33,12 @@ int opkg_download_pkg(pkg_t *pkg, const char *dir);
int opkg_prepare_url_for_install(const char *url, char **namep);
int opkg_verify_file (char *text_file, char *sig_file);
-#ifdef HAVE_CURL
+
+/* Curl cleanup function, does nothing unless opkg is configured with
+ * '--enable-curl'.
+ *
+ * This function is callable regardless of whether curl support is enabled in
+ * order to present a consistent API.
+ */
void opkg_curl_cleanup(void);
#endif
-#endif