[pacman-dev] [PATCH 1/4] lib/handle: add get/set methods for useragent

Rémy Oudompheng remyoudompheng at gmail.com
Mon Mar 28 15:21:12 EDT 2011


On 2011/3/28 Dave Reisner <d at falconindy.com> wrote:
> @@ -597,4 +598,18 @@ void SYMEXPORT alpm_option_set_checkspace(int checkspace)
>        handle->checkspace = checkspace;
>  }
>
> +void SYMEXPORT alpm_option_set_useragent(char *useragent)
> +{
> +       if(handle == NULL) {
> +               pm_errno = PM_ERR_HANDLE_NULL;
> +               return;
> +       }
> +       handle->useragent = useragent;
> +}
> +
> +const char SYMEXPORT *alpm_option_get_useragent()
> +{
> +       return handle->useragent;
> +}
> +
>  /* vim: set ts=2 sw=2 noet: */

I'd rather have alpm_option_set_useragent() return an int, just like
alpm_option_set_root(), and make alpm_option_get_useragent() return
NULL and set pm_errno if handle is NULL, just like
alpm_option_set_root().

As a matter or personal taste (and a bit of consistency obsession).
--
Rémy.


More information about the pacman-dev mailing list