[Libguestfs] [PATCH libguestfs 3/9] tilde.c: avoid a warning

Richard W.M. Jones rjones at redhat.com
Fri Aug 21 13:34:23 UTC 2009


On Fri, Aug 21, 2009 at 03:28:13PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
> 
> * fish/tilde.c (find_home_for_username): Change param type: s/int/size_t/
> (try_tilde_expansion): Adjust caller.
> ---
>  fish/tilde.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/fish/tilde.c b/fish/tilde.c
> index f0a2259..4085417 100644
> --- a/fish/tilde.c
> +++ b/fish/tilde.c
> @@ -30,7 +30,7 @@
>  #include "fish.h"
> 
>  static char *expand_home (const char *);
> -static const char *find_home_for_username (const char *, int);
> +static const char *find_home_for_username (const char *, size_t);
> 
>  /* This is called from the script loop if we find a candidate for
>   * ~username (tilde-expansion).
> @@ -52,10 +52,8 @@ try_tilde_expansion (char *str)
>     * username from the password file.
>     */
>    else {
> -    int len;
>      const char *home, *rest;
> -
> -    len = strcspn (&str[1], "/");
> +    size_t len = strcspn (&str[1], "/");
>      rest = &str[1+len];
> 
>      home = find_home_for_username (&str[1], len);
> @@ -106,7 +104,7 @@ expand_home (const char *append)
>   * or NULL if not found.
>   */
>  static const char *
> -find_home_for_username (const char *username, int ulen)
> +find_home_for_username (const char *username, size_t ulen)
>  {
>    struct passwd *pw;
> 
> -- 
> 1.6.4.378.g88f2f

ACK.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 75 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list