1
1
/*
2
- pgmspace.cpp - string functions that support PROGMEM
3
- Copyright (c) 2015 Michael C. Miller. All right reserved.
2
+ pgmspace.cpp - string functions that support PROGMEM
3
+ Copyright (c) 2015 Michael C. Miller. All right reserved.
4
4
5
- This library is free software; you can redistribute it and/or
6
- modify it under the terms of the GNU Lesser General Public
7
- License as published by the Free Software Foundation; either
8
- version 2.1 of the License, or (at your option) any later version.
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
9
10
- This library is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- Lesser General Public License for more details.
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ Lesser General Public License for more details.
14
14
15
- You should have received a copy of the GNU Lesser General Public
16
- License along with this library; if not, write to the Free Software
17
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
- */
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
19
20
20
#include < ctype.h>
21
21
#include " pgmspace.h"
22
22
23
- size_t ICACHE_FLASH_ATTR strnlen_P (const char * s, size_t size) {
23
+ size_t strnlen_P (const char * s, size_t size) {
24
24
const char * cp;
25
25
for (cp = s; size != 0 && pgm_read_byte (cp) != ' \0 ' ; cp++, size--);
26
- return (size_t )(cp - s);
26
+ return (size_t ) (cp - s);
27
27
}
28
28
29
- void * ICACHE_FLASH_ATTR memcpy_P (void * dest, const void * src, size_t count) {
29
+ void * memcpy_P (void * dest, const void * src, size_t count) {
30
30
const uint8_t * read = reinterpret_cast <const uint8_t *>(src);
31
31
uint8_t * write = reinterpret_cast <uint8_t *>(dest);
32
32
@@ -39,7 +39,7 @@ void* ICACHE_FLASH_ATTR memcpy_P(void* dest, const void* src, size_t count) {
39
39
return dest;
40
40
}
41
41
42
- char * ICACHE_FLASH_ATTR strncpy_P (char * dest, const char * src, size_t size) {
42
+ char * strncpy_P (char * dest, const char * src, size_t size) {
43
43
const char * read = src;
44
44
char * write = dest;
45
45
char ch = ' .' ;
@@ -48,19 +48,19 @@ char* ICACHE_FLASH_ATTR strncpy_P(char* dest, const char* src, size_t size) {
48
48
ch = pgm_read_byte (read ++);
49
49
*write ++ = ch;
50
50
size--;
51
- }
51
+ }
52
52
53
53
return dest;
54
54
}
55
55
56
- char * ICACHE_FLASH_ATTR strncat_P (char * dest, const char * src, size_t size) {
56
+ char * strncat_P (char * dest, const char * src, size_t size) {
57
57
char * write = dest;
58
58
59
59
while (*write != ' \0 ' )
60
60
{
61
61
write ++;
62
62
}
63
-
63
+
64
64
const char * read = src;
65
65
char ch = ' .' ;
66
66
@@ -80,7 +80,7 @@ char* ICACHE_FLASH_ATTR strncat_P(char* dest, const char* src, size_t size) {
80
80
return dest;
81
81
}
82
82
83
- int ICACHE_FLASH_ATTR strncmp_P (const char * str1, const char * str2P, size_t size) {
83
+ int strncmp_P (const char * str1, const char * str2P, size_t size) {
84
84
int result = 0 ;
85
85
86
86
while (size > 0 )
@@ -99,7 +99,7 @@ int ICACHE_FLASH_ATTR strncmp_P(const char* str1, const char* str2P, size_t size
99
99
return result;
100
100
}
101
101
102
- int ICACHE_FLASH_ATTR strncasecmp_P (const char * str1, const char * str2P, size_t size) {
102
+ int strncasecmp_P (const char * str1, const char * str2P, size_t size) {
103
103
int result = 0 ;
104
104
105
105
while (size > 0 )
@@ -118,7 +118,7 @@ int ICACHE_FLASH_ATTR strncasecmp_P(const char* str1, const char* str2P, size_t
118
118
return result;
119
119
}
120
120
121
- int ICACHE_FLASH_ATTR printf_P (const char * formatP, ...) {
121
+ int printf_P (const char * formatP, ...) {
122
122
int ret;
123
123
va_list arglist;
124
124
va_start (arglist, formatP);
@@ -129,13 +129,13 @@ int ICACHE_FLASH_ATTR printf_P(const char* formatP, ...) {
129
129
130
130
ret = os_printf (format, arglist);
131
131
132
- delete [] format;
132
+ delete[] format;
133
133
134
134
va_end (arglist);
135
135
return ret;
136
136
}
137
137
138
- int ICACHE_FLASH_ATTR snprintf_P (char * str, size_t strSize, const char * formatP, ...) {
138
+ int snprintf_P (char * str, size_t strSize, const char * formatP, ...) {
139
139
int ret;
140
140
va_list arglist;
141
141
va_start (arglist, formatP);
@@ -146,7 +146,7 @@ int ICACHE_FLASH_ATTR snprintf_P(char* str, size_t strSize, const char* formatP,
146
146
return ret;
147
147
}
148
148
149
- int ICACHE_FLASH_ATTR vsnprintf_P (char * str, size_t strSize, const char * formatP, va_list ap) {
149
+ int vsnprintf_P (char * str, size_t strSize, const char * formatP, va_list ap) {
150
150
int ret;
151
151
152
152
size_t fmtLen = strlen_P (formatP);
@@ -155,7 +155,7 @@ int ICACHE_FLASH_ATTR vsnprintf_P(char* str, size_t strSize, const char* formatP
155
155
156
156
ret = ets_vsnprintf (str, strSize, format, ap);
157
157
158
- delete [] format;
158
+ delete[] format;
159
159
160
160
return ret;
161
- }
161
+ }
0 commit comments