[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #28058] parameter checking in pgm_read_xxx()
From: |
Jan Waclawek |
Subject: |
[avr-libc-dev] [bug #28058] parameter checking in pgm_read_xxx() |
Date: |
Sat, 22 May 2010 13:01:21 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) |
Follow-up Comment #2, bug #28058 (project avr-libc):
Although not completely to the topic, as it again is related to
<avr/pgmspace> , I would propose also the following addition:
__attribute__((__always_inline__)) static inline size_t strlen_P(PGM_P s);
static inline size_t strlen_P(PGM_P s) {
return __builtin_constant_p(__builtin_strlen(s))
? __builtin_strlen(s) : __strlen_P(s);
}
and rename the existing strlen_P() function to __strlen_P(s) (including the
appropriate change in library function).
This allows the compiler to avoid call of the library function when length of
string is known at compile time.
The same change could be made to the far counterpart (strlen_PF()), in the
unlikely event that Carlos Lamas' library gets included into the official
avr-libc.
This item has been discussed on avrfreaks.net
<http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=92866&start=20&postdays=0&postorder=asc&highlight=>.
Jan Waclawek
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?28058>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] [bug #28058] parameter checking in pgm_read_xxx(),
Jan Waclawek <=