patchlwIP - A Lightweight TCP/IP stack - Patches: patch #6414, Avoid compiler errors/warnings...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #6414: Avoid compiler errors/warnings with mem_size_t if MEM_LIBC_MALLOC

Submitter:  Jonathan Larmour <jifl>
Submitted:  Fri 08 Feb 2008 08:26:01 PM UTC
   
 
Category:  None Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  jifl Open/Closed:  Closed
Planned Release:  1.3.0

Tue 04 Mar 2008 04:41:05 PM UTC, comment #3: 

And 5 minutes later I found the mail.

pbuf.c, line 210:
p = (struct pbuf*) mem_malloc(LWIP_MEM_ALIGN_SIZE(SIZEOF_STRUCT_PBUF + offset) + LWIP_MEM_ALIGN_SIZE(length));

ppp.c, line 401:
outpacket_buf[i] = (u_char *) mem_malloc(PPP_MRU+PPP_HDRLEN);

httpd.c, line 215 (httpserver_raw example)
hs = (struct http_state *) mem_malloc(sizeof(struct http_state));

Committed.

Jonathan Larmour <jifl>
Group Member
Tue 04 Mar 2008 04:33:18 PM UTC, comment #2: 

I have checked it in. I can't find the comment on lwip-devel about mem_malloc again, so let me know if there's anything in the area that wants doing or point me at it.

Jonathan Larmour <jifl>
Group Member
Tue 04 Mar 2008 01:32:20 PM UTC, comment #1: 

Yes please Jifl, can you check this in prior to the final 1.3.0 release?

There was some concern on the lwip-devel mailing list that the value of mem_malloc wasn't being cast, but as I understand it (void *) shouldn't need a cast, and so I'm not worried about that.  Of course, it's harmless to do the cast, so if others need this for their compiler I've no objection to it going in.

Kieran Mansley <kieranm>
Group Member
Fri 08 Feb 2008 08:26:01 PM UTC, original submission:  

As per the discussion "Possible mistake in mem.h" here: http://lists.gnu.org/archive/html/lwip-devel/2008-01/threads.html

here is an untested patch.

Can someone (Iordan?) please verify it resolves the issue.

Note that I had to remove the MEM_SIZE_F format string, since I could not do anything sane with it if mem_size_t is size_t. The size of size_t is unknown for the purposes of determining the format specifier, and getting the wrong size could screw up the stack on some architectures. I doubt the %z specifier (the offical ISO C 99 way) is portable enough to rely on. We could a SIZE_T_F requirement on ports, but that seems arduous given the only use is from a debug statistics display function, so I've just cast to 32.

Kieran, please let me know if this is ok for check-in prior to 1.3.0 or not (once tested).

Jifl

Jonathan Larmour <jifl>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #14999:  mem.size_t.patch added by jifl (4KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by jifl (Submitted the item)
  • -email is unavailable- added by jifl (Iordan Neshev)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-03-04 jifl StatusNeed Info Done
        Open/ClosedOpen Closed
    2008-03-04 kieranm Planned ReleaseNone 1.3.0
    2008-02-08 jifl Attached File- Added mem.size_t.patch, #14999
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code