From a5b6a75787be01fc2a030b68eeaba07bc26db469 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 14 Jan 2011 12:17:39 -0500 Subject: share code between libfetch and libcurl no actual code changes here. change preprocessor logic to include get_tempfile, get_destfile, signal handler enum, and the interrupt handler logic when either HAVE_LIBCURL or HAVE_LIBFETCH are defined. Signed-off-by: Dave Reisner --- lib/libalpm/dload.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 4109e451..a08eda16 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -59,7 +59,7 @@ static char *get_filename(const char *url) { return(filename); } -#ifdef HAVE_LIBFETCH +#if defined(HAVE_LIBFETCH) || defined(HAVE_LIBCURL) static char *get_destfile(const char *path, const char *filename) { char *destfile; /* len = localpath len + filename len + null */ @@ -80,6 +80,17 @@ static char *get_tempfile(const char *path, const char *filename) { return(tempfile); } +#define check_stop() if(dload_interrupted) { ret = -1; goto cleanup; } +enum sighandlers { OLD = 0, NEW = 1 }; + +int dload_interrupted; +static void inthandler(int signum) +{ + dload_interrupted = 1; +} +#endif + +#ifdef HAVE_LIBFETCH static const char *fetch_gethost(struct url *fileurl) { const char *host = _("disk"); @@ -89,15 +100,6 @@ static const char *fetch_gethost(struct url *fileurl) return(host); } -int dload_interrupted; -static void inthandler(int signum) -{ - dload_interrupted = 1; -} - -#define check_stop() if(dload_interrupted) { ret = -1; goto cleanup; } -enum sighandlers { OLD = 0, NEW = 1 }; - static int fetch_download_internal(const char *url, const char *localpath, int force) { FILE *localf = NULL; -- cgit v1.2.3-70-g09d2