@@ -45,7 +45,7 @@ typedef struct {
45
45
} ini_parse_string_ctx ;
46
46
47
47
/* Strip whitespace chars off end of given string, in place. Return s. */
48
- static char * rstrip (char * s )
48
+ static char * ini_rstrip (char * s )
49
49
{
50
50
char * p = s + strlen (s );
51
51
while (p > s && isspace ((unsigned char )(* -- p )))
@@ -54,7 +54,7 @@ static char* rstrip(char* s)
54
54
}
55
55
56
56
/* Return pointer to first non-whitespace char in given string. */
57
- static char * lskip (const char * s )
57
+ static char * ini_lskip (const char * s )
58
58
{
59
59
while (* s && isspace ((unsigned char )(* s )))
60
60
s ++ ;
@@ -64,7 +64,7 @@ static char* lskip(const char* s)
64
64
/* Return pointer to first char (of chars) or inline comment in given string,
65
65
or pointer to NUL at end of string if neither found. Inline comment must
66
66
be prefixed by a whitespace character to register as a comment. */
67
- static char * find_chars_or_comment (const char * s , const char * chars )
67
+ static char * ini_find_chars_or_comment (const char * s , const char * chars )
68
68
{
69
69
#if INI_ALLOW_INLINE_COMMENTS
70
70
int was_space = 0 ;
@@ -83,7 +83,7 @@ static char* find_chars_or_comment(const char* s, const char* chars)
83
83
84
84
/* Similar to strncpy, but ensures dest (size bytes) is
85
85
NUL-terminated, and doesn't pad with NULs. */
86
- static char * strncpy0 (char * dest , const char * src , size_t size )
86
+ static char * ini_strncpy0 (char * dest , const char * src , size_t size )
87
87
{
88
88
/* Could use strncpy internally, but it causes gcc warnings (see issue #91) */
89
89
size_t i ;
@@ -164,18 +164,18 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
164
164
start += 3 ;
165
165
}
166
166
#endif
167
- start = lskip ( rstrip (start ));
167
+ start = ini_lskip ( ini_rstrip (start ));
168
168
169
169
if (strchr (INI_START_COMMENT_PREFIXES , * start )) {
170
170
/* Start-of-line comment */
171
171
}
172
172
#if INI_ALLOW_MULTILINE
173
173
else if (* prev_name && * start && start > line ) {
174
174
#if INI_ALLOW_INLINE_COMMENTS
175
- end = find_chars_or_comment (start , NULL );
175
+ end = ini_find_chars_or_comment (start , NULL );
176
176
if (* end )
177
177
* end = '\0' ;
178
- rstrip (start );
178
+ ini_rstrip (start );
179
179
#endif
180
180
/* Non-blank line with leading whitespace, treat as continuation
181
181
of previous name's value (as per Python configparser). */
@@ -185,10 +185,10 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
185
185
#endif
186
186
else if (* start == '[') {
187
187
/* A "[section]" line */
188
- end = find_chars_or_comment (start + 1 , "]" );
188
+ end = ini_find_chars_or_comment (start + 1 , "]" );
189
189
if (* end == ']' ) {
190
190
* end = '\0' ;
191
- strncpy0 (section , start + 1 , sizeof (section ));
191
+ ini_strncpy0 (section , start + 1 , sizeof (section ));
192
192
* prev_name = '\0' ;
193
193
#if INI_CALL_HANDLER_ON_NEW_SECTION
194
194
if (!HANDLER (user , section , NULL , NULL ) && !error )
@@ -202,29 +202,29 @@ int ini_parse_stream(ini_reader reader, void* stream, ini_handler handler,
202
202
}
203
203
else if (* start ) {
204
204
/* Not a comment, must be a name[=:]value pair */
205
- end = find_chars_or_comment (start , "=:" );
205
+ end = ini_find_chars_or_comment (start , "=:" );
206
206
if (* end == '=' || * end == ':' ) {
207
207
* end = '\0' ;
208
- name = rstrip (start );
208
+ name = ini_rstrip (start );
209
209
value = end + 1 ;
210
210
#if INI_ALLOW_INLINE_COMMENTS
211
- end = find_chars_or_comment (value , NULL );
211
+ end = ini_find_chars_or_comment (value , NULL );
212
212
if (* end )
213
213
* end = '\0' ;
214
214
#endif
215
- value = lskip (value );
216
- rstrip (value );
215
+ value = ini_lskip (value );
216
+ ini_rstrip (value );
217
217
218
218
/* Valid name[=:]value pair found, call handler */
219
- strncpy0 (prev_name , name , sizeof (prev_name ));
219
+ ini_strncpy0 (prev_name , name , sizeof (prev_name ));
220
220
if (!HANDLER (user , section , name , value ) && !error )
221
221
error = lineno ;
222
222
}
223
223
else if (!error ) {
224
224
/* No '=' or ':' found on name[=:]value line */
225
225
#if INI_ALLOW_NO_VALUE
226
226
* end = '\0' ;
227
- name = rstrip (start );
227
+ name = ini_rstrip (start );
228
228
if (!HANDLER (user , section , name , NULL ) && !error )
229
229
error = lineno ;
230
230
#else
0 commit comments