summaryrefslogtreecommitdiff
path: root/legacy/eina
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-06-29 10:45:58 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-06-29 10:45:58 +0000
commit54e102fcc41bdbb3c7c7ba54ca89460913c48c73 (patch)
tree999ed1e24eb281873158b1e4c85398264b7748ea /legacy/eina
parentcda0901ae0edf5f15c745a86b2f9da40ad5f801e (diff)
eina: also track lines index.
SVN revision: 73029
Diffstat (limited to 'legacy/eina')
-rw-r--r--legacy/eina/src/include/eina_file.h1
-rw-r--r--legacy/eina/src/lib/eina_file.c10
2 files changed, 10 insertions, 1 deletions
diff --git a/legacy/eina/src/include/eina_file.h b/legacy/eina/src/include/eina_file.h
index 246410f2d6..0518c12655 100644
--- a/legacy/eina/src/include/eina_file.h
+++ b/legacy/eina/src/include/eina_file.h
@@ -204,6 +204,7 @@ struct _Eina_File_Lines
204 struct { 204 struct {
205 const char *start; 205 const char *start;
206 const char *end; 206 const char *end;
207 unsigned int index;
207 } line; 208 } line;
208 unsigned long long length; 209 unsigned long long length;
209}; 210};
diff --git a/legacy/eina/src/lib/eina_file.c b/legacy/eina/src/lib/eina_file.c
index 33137cc2a6..b5dd5cdd2a 100644
--- a/legacy/eina/src/lib/eina_file.c
+++ b/legacy/eina/src/lib/eina_file.c
@@ -1175,13 +1175,20 @@ static Eina_Bool
1175_eina_file_map_lines_iterator_next(Eina_Lines_Iterator *it, void **data) 1175_eina_file_map_lines_iterator_next(Eina_Lines_Iterator *it, void **data)
1176{ 1176{
1177 const char *eol; 1177 const char *eol;
1178 unsigned char match;
1178 1179
1179 if (it->current.line.end >= it->end) 1180 if (it->current.line.end >= it->end)
1180 return EINA_FALSE; 1181 return EINA_FALSE;
1181 1182
1183 match = *it->current.line.end;
1182 while ((*it->current.line.end == '\n' || *it->current.line.end == '\r') 1184 while ((*it->current.line.end == '\n' || *it->current.line.end == '\r')
1183 && it->current.line.end < it->end) 1185 && it->current.line.end < it->end)
1184 it->current.line.end++; 1186 {
1187 if (match == *it->current.line.end)
1188 it->current.line.index++;
1189 it->current.line.end++;
1190 }
1191 it->current.line.index++;
1185 1192
1186 if (it->current.line.end == it->end) 1193 if (it->current.line.end == it->end)
1187 return EINA_FALSE; 1194 return EINA_FALSE;
@@ -1246,6 +1253,7 @@ eina_file_map_lines(Eina_File *file)
1246 it->boundary = 4096; 1253 it->boundary = 4096;
1247 it->current.line.start = it->map; 1254 it->current.line.start = it->map;
1248 it->current.line.end = it->current.line.start; 1255 it->current.line.end = it->current.line.start;
1256 it->current.line.index = 0;
1249 it->current.length = 0; 1257 it->current.length = 0;
1250 it->end = it->map + it->fp->length; 1258 it->end = it->map + it->fp->length;
1251 1259