Return pointer to first char (of chars) or inline comment in given string, or pointer to null at end of string if neither found. Inline comment must be prefixed by a whitespace character to register as a comment. */
| 45 | or pointer to null at end of string if neither found. Inline comment must |
| 46 | be prefixed by a whitespace character to register as a comment. */ |
| 47 | static char* find_chars_or_comment(const char* s, const char* chars) |
| 48 | { |
| 49 | #if INI_ALLOW_INLINE_COMMENTS |
| 50 | int was_space = 0; |
| 51 | while (*s && (!chars || !strchr(chars, *s)) && |
| 52 | !(was_space && strchr(INI_INLINE_COMMENT_PREFIXES, *s))) { |
| 53 | was_space = isspace((unsigned char)(*s)); |
| 54 | s++; |
| 55 | } |
| 56 | #else |
| 57 | while (*s && (!chars || !strchr(chars, *s))) { |
| 58 | s++; |
| 59 | } |
| 60 | #endif |
| 61 | return (char*)s; |
| 62 | } |
| 63 | |
| 64 | /* Version of strncpy that ensures dest (size bytes) is null-terminated. */ |
| 65 | static char* strncpy0(char* dest, const char* src, size_t size) |