linenum.c (60786) | linenum.c (89019) |
---|---|
1/* 2 * Copyright (C) 1984-2000 Mark Nudelman 3 * 4 * You may distribute under the terms of either the GNU General Public 5 * License or the Less License, as specified in the README file. 6 * 7 * For more information about less, or for information on how to 8 * contact the author, see the README file. --- 283 unchanged lines hidden (view full) --- 292 * reading the file forward or backward till we 293 * get to the place we want. 294 * 295 * First decide whether we should go forward from the 296 * previous one or backwards from the next one. 297 * The decision is based on which way involves 298 * traversing fewer bytes in the file. 299 */ | 1/* 2 * Copyright (C) 1984-2000 Mark Nudelman 3 * 4 * You may distribute under the terms of either the GNU General Public 5 * License or the Less License, as specified in the README file. 6 * 7 * For more information about less, or for information on how to 8 * contact the author, see the README file. --- 283 unchanged lines hidden (view full) --- 292 * reading the file forward or backward till we 293 * get to the place we want. 294 * 295 * First decide whether we should go forward from the 296 * previous one or backwards from the next one. 297 * The decision is based on which way involves 298 * traversing fewer bytes in the file. 299 */ |
300 flush(); | |
301#if HAVE_TIME 302 startime = get_time(); 303#endif 304 if (p == &anchor || pos - p->prev->pos < p->pos - pos) 305 { 306 /* 307 * Go forward. 308 */ --- 72 unchanged lines hidden (view full) --- 381 * Find the entry nearest to the line number we want. 382 */ 383 for (p = anchor.next; p != &anchor && p->line < lno; p = p->next) 384 continue; 385 if (p->line == lno) 386 /* Found it exactly. */ 387 return (p->pos); 388 | 300#if HAVE_TIME 301 startime = get_time(); 302#endif 303 if (p == &anchor || pos - p->prev->pos < p->pos - pos) 304 { 305 /* 306 * Go forward. 307 */ --- 72 unchanged lines hidden (view full) --- 380 * Find the entry nearest to the line number we want. 381 */ 382 for (p = anchor.next; p != &anchor && p->line < lno; p = p->next) 383 continue; 384 if (p->line == lno) 385 /* Found it exactly. */ 386 return (p->pos); 387 |
389 flush(); | |
390 if (p == &anchor || lno - p->prev->line < p->line - lno) 391 { 392 /* 393 * Go forward. 394 */ 395 p = p->prev; 396 if (ch_seek(p->pos)) 397 return (NULL_POSITION); --- 57 unchanged lines hidden --- | 388 if (p == &anchor || lno - p->prev->line < p->line - lno) 389 { 390 /* 391 * Go forward. 392 */ 393 p = p->prev; 394 if (ch_seek(p->pos)) 395 return (NULL_POSITION); --- 57 unchanged lines hidden --- |