avr-libc-commit
[Top][All Lists]
Advanced

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

[avr-libc-commit] [2241] * include/avr/pgmspace.h: Reorder so __strlen_P


From: Joerg Wunsch
Subject: [avr-libc-commit] [2241] * include/avr/pgmspace.h: Reorder so __strlen_P is declared by
Date: Wed, 11 May 2011 12:59:49 +0000

Revision: 2241
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2241
Author:   joerg_wunsch
Date:     2011-05-11 12:59:48 +0000 (Wed, 11 May 2011)
Log Message:
-----------
* include/avr/pgmspace.h: Reorder so __strlen_P is declared by
the time it is attempted to be used.
* libc/stdlib/dtostre.c: Part #2 of fix for bug #32988: make
`s' a `const char *' as it is pointing to a constant (flash)
string.

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?32988

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/include/avr/pgmspace.h
    trunk/avr-libc/libc/stdlib/dtostre.c

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2011-05-09 22:18:18 UTC (rev 2240)
+++ trunk/avr-libc/ChangeLog    2011-05-11 12:59:48 UTC (rev 2241)
@@ -1,3 +1,11 @@
+2011-05-11  Joerg Wunsch <address@hidden>
+
+       * include/avr/pgmspace.h: Reorder so __strlen_P is declared by
+       the time it is attempted to be used.
+       * libc/stdlib/dtostre.c: Part #2 of fix for bug #32988: make
+       `s' a `const char *' as it is pointing to a constant (flash)
+       string.
+
 2011-05-09  Eric B. Weddington  <address@hidden>
 
        Fix for bug #32988.

Modified: trunk/avr-libc/include/avr/pgmspace.h
===================================================================
--- trunk/avr-libc/include/avr/pgmspace.h       2011-05-09 22:18:18 UTC (rev 
2240)
+++ trunk/avr-libc/include/avr/pgmspace.h       2011-05-11 12:59:48 UTC (rev 
2241)
@@ -905,14 +905,6 @@
 
 
 
-__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);
-} 
-
-
-
 extern PGM_VOID_P memchr_P(PGM_VOID_P, int __val, size_t __len) __ATTR_CONST__;
 extern int memcmp_P(const void *, PGM_VOID_P, size_t) __ATTR_PURE__;
 extern void *memccpy_P(void *, PGM_VOID_P, int __val, size_t);
@@ -960,6 +952,14 @@
 extern int memcmp_PF(const void *, uint_farptr_t, size_t) __ATTR_PURE__;
 
 
+__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);
+} 
+
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/avr-libc/libc/stdlib/dtostre.c
===================================================================
--- trunk/avr-libc/libc/stdlib/dtostre.c        2011-05-09 22:18:18 UTC (rev 
2240)
+++ trunk/avr-libc/libc/stdlib/dtostre.c        2011-05-11 12:59:48 UTC (rev 
2241)
@@ -37,12 +37,12 @@
 char *
 dtostre (double val, char *sbeg, unsigned char prec, unsigned char flags)
 {
-    __attribute__((progmem)) static char str_nan[2][4] =
+    __attribute__((progmem)) static const char str_nan[2][4] =
        {"nan", "NAN"};
-    __attribute__((progmem)) static char str_inf[2][sizeof(str_nan[0])] =
+    __attribute__((progmem)) static const char str_inf[2][sizeof(str_nan[0])] =
        {"inf", "INF"};
     char *d;           /* dst  */
-    char *s;           /* src  */
+    const char *s;             /* src  */
     signed char exp;
     unsigned char vtype;
 




reply via email to

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