lineno==0 gives the most recent message (e.g. "Do you want to call panic..." if called from #panic) */
| 568 | /* lineno==0 gives the most recent message (e.g. |
| 569 | "Do you want to call panic..." if called from #panic) */ |
| 570 | const char * |
| 571 | get_saved_pline(int lineno USED_if_dumplog) |
| 572 | { |
| 573 | #ifdef DUMPLOG_CORE |
| 574 | int p; |
| 575 | int limit = DUMPLOG_MSG_COUNT; |
| 576 | |
| 577 | if (lineno >= DUMPLOG_MSG_COUNT) |
| 578 | return NULL; |
| 579 | p = (gs.saved_pline_index - 1) % DUMPLOG_MSG_COUNT; |
| 580 | |
| 581 | while (limit--) { |
| 582 | if (gs.saved_plines[p]) { /* valid line */ |
| 583 | if (lineno--) { |
| 584 | p = (p - 1 + DUMPLOG_MSG_COUNT) % DUMPLOG_MSG_COUNT; |
| 585 | } else { |
| 586 | return gs.saved_plines[p]; |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | #endif /* DUMPLOG_CORE */ |
| 591 | return NULL; |
| 592 | } |
| 593 | |
| 594 | #undef USED_if_dumplog |
| 595 |