lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #62832] Allow NULL buffer to pbuf_get_contiguous()


From: Colin Foster
Subject: [lwip-devel] [bug #62832] Allow NULL buffer to pbuf_get_contiguous()
Date: Thu, 28 Jul 2022 14:40:24 -0400 (EDT)

URL:
  <https://savannah.nongnu.org/bugs/?62832>

                 Summary: Allow NULL buffer to pbuf_get_contiguous()
                 Project: lwIP - A Lightweight TCP/IP stack
               Submitter: colin_foster_ia
               Submitted: Thu 28 Jul 2022 06:40:23 PM UTC
                Category: pbufs
                Severity: 3 - Normal
              Item Group: Change Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 28 Jul 2022 06:40:23 PM UTC By: Colin Foster <colin_foster_ia>
The pbuf_get_contiguous currently requires a non-NULL buffer and a non-zero
buffer size:

https://git.savannah.nongnu.org/cgit/lwip.git/tree/src/core/pbuf.c#n1111

It could be quite useful if an application could call it with NULL / 0, thus
avoiding pbuf_copy_partial if possible, as well as memory allocation.

For instance:


struct foo *foo = pbuf_get_contiguous(pbuf, NULL, 0, sizeof(*foo), offset);
if (!foo)
{
  // error condition / malloc / stack call / etc
}


As it currently stands, additional stack would be required. For instance:


struct foo foo;
struct foo *pfoo = pbuf_get_contiguous(pbuf, &foo, sizeof(foo), sizeof(foo),
offset);








    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?62832>

_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/




reply via email to

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