FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 01-23-2012, 02:25 PM
Dan McGee
 
Default lib/dload: give uniform naming to curl CB functions

On Sun, Jan 22, 2012 at 7:31 PM, Dave Reisner <d@falconindy.com> wrote:
> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> ---
> *lib/libalpm/dload.c | * *8 ++++----
> *1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index 790080c..c1be528 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -90,7 +90,7 @@ static void inthandler(int UNUSED signum)
> * * * *dload_interrupted = ABORT_SIGINT;
> *}
>
> -static int curl_progress(void *file, double dltotal, double dlnow,
> +static int curl_progress_cb(void *file, double dltotal, double dlnow,
> * * * * * * * *double UNUSED ultotal, double UNUSED ulnow)
> *{
> * * * *struct dload_payload *payload = (struct dload_payload *)file;
> @@ -192,7 +192,7 @@ static mode_t _getumask(void)
> * * * *return mask;
> *}
>
> -static size_t parse_headers(void *ptr, size_t size, size_t nmemb, void *user)
> +static size_t curl_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *user)
Wouldn't it make more sense to not put our functions in the curl_*
"namespace" and just use dload_parseheader_cb, etc. instead?

> *{
> * * * *size_t realsize = size * nmemb;
> * * * *const char *fptr, *endptr = NULL;
> @@ -287,11 +287,11 @@ static void curl_set_handle_opts(struct dload_payload *payload,
> * * * *curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
> * * * *curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
> * * * *curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
> - * * * curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
> + * * * curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curl_progress_cb);
> * * * *curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *)payload);
> * * * *curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1024L);
> * * * *curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
> - * * * curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, parse_headers);
> + * * * curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_parseheader_cb);
> * * * *curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload);
> * * * *curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
> * * * *curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, curl_sockopt_cb);
> --
> 1.7.8.4
>
>
 
Old 01-23-2012, 02:29 PM
Dave Reisner
 
Default lib/dload: give uniform naming to curl CB functions

On Mon, Jan 23, 2012 at 09:25:18AM -0600, Dan McGee wrote:
> On Sun, Jan 22, 2012 at 7:31 PM, Dave Reisner <d@falconindy.com> wrote:
> > Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> > ---
> > *lib/libalpm/dload.c | * *8 ++++----
> > *1 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> > index 790080c..c1be528 100644
> > --- a/lib/libalpm/dload.c
> > +++ b/lib/libalpm/dload.c
> > @@ -90,7 +90,7 @@ static void inthandler(int UNUSED signum)
> > * * * *dload_interrupted = ABORT_SIGINT;
> > *}
> >
> > -static int curl_progress(void *file, double dltotal, double dlnow,
> > +static int curl_progress_cb(void *file, double dltotal, double dlnow,
> > * * * * * * * *double UNUSED ultotal, double UNUSED ulnow)
> > *{
> > * * * *struct dload_payload *payload = (struct dload_payload *)file;
> > @@ -192,7 +192,7 @@ static mode_t _getumask(void)
> > * * * *return mask;
> > *}
> >
> > -static size_t parse_headers(void *ptr, size_t size, size_t nmemb, void *user)
> > +static size_t curl_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *user)
> Wouldn't it make more sense to not put our functions in the curl_*
> "namespace" and just use dload_parseheader_cb, etc. instead?

Yeah, I'll buy this.

> > *{
> > * * * *size_t realsize = size * nmemb;
> > * * * *const char *fptr, *endptr = NULL;
> > @@ -287,11 +287,11 @@ static void curl_set_handle_opts(struct dload_payload *payload,
> > * * * *curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
> > * * * *curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
> > * * * *curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
> > - * * * curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
> > + * * * curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curl_progress_cb);
> > * * * *curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *)payload);
> > * * * *curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1024L);
> > * * * *curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
> > - * * * curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, parse_headers);
> > + * * * curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_parseheader_cb);
> > * * * *curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload);
> > * * * *curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
> > * * * *curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, curl_sockopt_cb);
> > --
> > 1.7.8.4
> >
> >
>
 

Thread Tools




All times are GMT. The time now is 11:12 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org