break;
case 100:
/* Skip \r\n and whitespaces */
- if (*p == '\r' || *p == '\n' || g_ascii_isspace (*p)) {
+ if (*p == '\r' || *p == '\n' || *p == '\0' || g_ascii_isspace (*p)) {
p++;
}
else {
if (s) {
func (data->cur_data, s, hash_fill);
+ msg_debug_pool ("insert element (before comment): %s", s);
}
- c = p;
}
+ c = NULL;
data->state = 1;
}
else if (*p == '\r' || *p == '\n' || p == end) {
if (s) {
func (data->cur_data, s, hash_fill);
+ msg_debug_pool ("insert element (before EOL): %s", s);
}
/* Skip EOL symbols */
- while ((*p == '\r' || *p == '\n') && p <= end) {
+ while ((*p == '\r' || *p == '\n') && p < end) {
p++;
}
- c = p;
- p ++;
+ if (p == end) {
+ p ++;
+ c = NULL;
+ }
+ else {
+ c = p;
+ }
}
else {
p++;
case 1:
/* Skip comment till end of line */
if (*p == '\r' || *p == '\n') {
- while ((*p == '\r' || *p == '\n') && p <= end) {
+ while ((*p == '\r' || *p == '\n') && p < end) {
p++;
}
- c = p;
- p ++;
+
+ if (p == end) {
+ p ++;
+ c = NULL;
+ }
+ else {
+ c = p;
+ }
data->state = 0;
}
else {
}
}
+ if (c >= end) {
+ c = NULL;
+ }
+
return c;
}