lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] PBUFS + LWIP 1.3.0 + memory allocation


From: Jeff Barber
Subject: Re: [lwip-users] PBUFS + LWIP 1.3.0 + memory allocation
Date: Thu, 11 Feb 2010 08:15:31 -0500

In this particular case, the function definition in the header file:
  static void *mem_realloc(void *mem, mem_size_t size)
  {
    LWIP_UNUSED_ARG(size);
    return mem;
  }

could simply be replaced with the near-equivalent (which already
appears a few lines further on under a different combination of
ifdefs):
  #define mem_realloc(mem, size) (mem)

Jeff

On Thu, Feb 11, 2010 at 7:18 AM, Kieran Mansley <address@hidden> wrote:
> On Wed, 2010-02-10 at 13:24 -0500, Bill Auerbach wrote:
>>
>> Worse is that every inclusion of pbuf.h that didn't define mem_realloc
>> will
>> cause this function to be defined.  Since it returns an argument,
>> there will
>> be compilers that generate code and create multiple copies of this
>> function.
>> It's small but still wasteful.  I believe function definitions are not
>> appropriate in H files because you don't know how they will be
>> handled.
>
> In the case of lwIP where we can't rely on the compiler supporting
> inline I agree.  functions defined in .h files should be avoided in
> lwIP.
>
> Kieran
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]