Re: [RFC v5][PATCH 2/8] General infrastructure for checkpoint restart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2008-09-13 at 19:06 -0400, Oren Laadan wrote:
> 
> +void *cr_hbuf_get(struct cr_ctx *ctx, int n)
> +{
> +       void *ptr;
> +
> +       BUG_ON(ctx->hpos + n > CR_HBUF_TOTAL);
> +       ptr = (void *) (((char *) ctx->hbuf) + ctx->hpos);
> +       ctx->hpos += n;
> +       return ptr;
> +}

All of the casting here is unnecessary.  'void *' behaves like 'char *'
when you do arithmetic on it.  

I really do detest having a memory allocator BUG_ON() when it runs out
of space.  

-- Dave

_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux