buglwIP - A Lightweight TCP/IP stack - Bugs: bug #58467, stats.c inconsistent use of...

 
 

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

bug #58467: stats.c inconsistent use of STAT_COUNTER_F

Submitted by:  Mike Protts <mikeprotts>
Submitted on:  Sun 31 May 2020 10:00:02 AM UTC  
 
Category:  None Severity:  3 - Normal
Item Group:  Change Request Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  git head

Sun 31 May 2020 10:00:02 AM UTC, original submission:  

The code in stats.c, starting at line 104, is currently:

void
stats_display_mem(struct stats_mem *mem, const char *name)
{
  LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
  LWIP_PLATFORM_DIAG(("avail: %"MEM_SIZE_F"\n\t", mem->avail));
  LWIP_PLATFORM_DIAG(("used: %"MEM_SIZE_F"\n\t", mem->used));
  LWIP_PLATFORM_DIAG(("max: %"MEM_SIZE_F"\n\t", mem->max));
  LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n", mem->err));
}

should be using STAT_COUNTER_F for consistency:

void
stats_display_mem(struct stats_mem *mem, const char *name)
{
  LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
  LWIP_PLATFORM_DIAG(("avail: %"STAT_COUNTER_F"\n\t", mem->avail));
  LWIP_PLATFORM_DIAG(("used: %"STAT_COUNTER_F"\n\t", mem->used));
  LWIP_PLATFORM_DIAG(("max: %"STAT_COUNTER_F"\n\t", mem->max));
  LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n", mem->err));
}

This causes problems with platforms that do not support the h length modifier, e.g. ChibiOS, as the value is replaced with the string literal "hu".  With version LWIP version 2.0.3 using LWIP_STATS_LARGE 1 caused all stats to print correctly, with version 2.1.2 (and later) the error shows for these particular cases.

Mike Protts <mikeprotts>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mikeprotts (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.6