"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "locfile.c" between
jq-1.5.tar.gz and jq-1.6.tar.gz

About: jq is a lightweight and flexible command-line JSON processor.

locfile.c  (jq-1.5):locfile.c  (jq-1.6)
skipping to change at line 23 skipping to change at line 23
l->jq = jq; l->jq = jq;
l->fname = jv_string(fname); l->fname = jv_string(fname);
l->data = jv_mem_alloc(length); l->data = jv_mem_alloc(length);
memcpy((char*)l->data,data,length); memcpy((char*)l->data,data,length);
l->length = length; l->length = length;
l->nlines = 1; l->nlines = 1;
l->refct = 1; l->refct = 1;
for (int i=0; i<length; i++) { for (int i=0; i<length; i++) {
if (data[i] == '\n') l->nlines++; if (data[i] == '\n') l->nlines++;
} }
l->linemap = jv_mem_alloc(sizeof(int) * (l->nlines + 1)); l->linemap = jv_mem_calloc(sizeof(int), (l->nlines + 1));
l->linemap[0] = 0; l->linemap[0] = 0;
int line = 1; int line = 1;
for (int i=0; i<length; i++) { for (int i=0; i<length; i++) {
if (data[i] == '\n') { if (data[i] == '\n') {
l->linemap[line] = i+1; // at start of line, not of \n l->linemap[line] = i+1; // at start of line, not of \n
line++; line++;
} }
} }
l->linemap[l->nlines] = length+1; // virtual last \n l->linemap[l->nlines] = length+1; // virtual last \n
return l; return l;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)