[sheepdog] [PATCH] sheep/oc: use strtoull instead of strtoul

Hitoshi Mitake mitake.hitoshi at gmail.com
Wed Sep 3 08:39:17 CEST 2014


On Mon, Sep 1, 2014 at 11:53 AM, Ruoyu <liangry at ucweb.com> wrote:
> Although long long data type is the same as long data type in 64-bit
> platform, it is better to use only one of them. Since we use strtoull
> in other place of the module, we should not use strtoul.
>
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  sheep/object_cache.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

BTW, the variable vid in load_cache() is declared as unsigned long.
Conventionally we declare variables for storing vid as uint32_t. I
think the variable should also be declared as uint32_t. I'm glad if
you can do this cleaning, too.

Thanks,
Hitoshi

>
> diff --git a/sheep/object_cache.c b/sheep/object_cache.c
> index edfac6d..0d115b4 100644
> --- a/sheep/object_cache.c
> +++ b/sheep/object_cache.c
> @@ -1277,8 +1277,8 @@ static int load_cache(void)
>         while ((d = readdir(dir))) {
>                 if (!strncmp(d->d_name, ".", 1))
>                         continue;
> -               vid = strtoul(d->d_name, NULL, 16);
> -               if (vid == ULONG_MAX)
> +               vid = strtoull(d->d_name, NULL, 16);
> +               if (vid == ULLONG_MAX)
>                         continue;
>
>                 load_cache_object(find_object_cache(vid, true));
> --
> 1.8.3.2
>
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list