diff options
Diffstat (limited to 'src/wordsplit.c')
-rw-r--r-- | src/wordsplit.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/wordsplit.c b/src/wordsplit.c index f94015a..e979f27 100644 --- a/src/wordsplit.c +++ b/src/wordsplit.c | |||
@@ -805,25 +805,35 @@ wordsplit_finish (struct wordsplit *wsp) | |||
805 | n++; | 805 | n++; |
806 | } | 806 | } |
807 | 807 | ||
808 | if (n == 0 && (wsp->ws_flags & WRDSF_INCREMENTAL)) | 808 | if (n == 0) |
809 | { | 809 | { |
810 | /* The loop above have eliminated all nodes. Restart the | 810 | /* The loop above have eliminated all nodes. */ |
811 | processing, if there's any input left. */ | 811 | if (wsp->ws_flags & WRDSF_INCREMENTAL) |
812 | if (wsp->ws_endp < wsp->ws_len) | ||
813 | { | 812 | { |
814 | int rc; | 813 | /* Restart the processing, if there's any input left. */ |
815 | if (wsp->ws_flags & WRDSF_SHOWDBG) | 814 | if (wsp->ws_endp < wsp->ws_len) |
816 | wsp->ws_debug (_("Restarting")); | 815 | { |
817 | rc = wordsplit_process_list (wsp, skip_delim (wsp)); | 816 | int rc; |
818 | if (rc) | 817 | if (wsp->ws_flags & WRDSF_SHOWDBG) |
819 | return rc; | 818 | wsp->ws_debug (_("Restarting")); |
819 | rc = wordsplit_process_list (wsp, skip_delim (wsp)); | ||
820 | if (rc) | ||
821 | return rc; | ||
822 | } | ||
823 | else | ||
824 | { | ||
825 | wsp->ws_error = WRDSE_EOF; | ||
826 | return WRDSE_EOF; | ||
827 | } | ||
828 | goto again; | ||
820 | } | 829 | } |
821 | else | 830 | |
831 | if (wsp->ws_flags & WRDSF_NOSPLIT) | ||
822 | { | 832 | { |
823 | wsp->ws_error = WRDSE_EOF; | 833 | if (wordsplit_add_segm (wsp, 0, 0, _WSNF_EMPTYOK)) |
824 | return WRDSE_EOF; | 834 | return wsp->ws_errno; |
835 | n = 1; | ||
825 | } | 836 | } |
826 | goto again; | ||
827 | } | 837 | } |
828 | 838 | ||
829 | if (alloc_space (wsp, n + 1)) | 839 | if (alloc_space (wsp, n + 1)) |
@@ -2412,6 +2422,7 @@ wordsplit_process_list (struct wordsplit *wsp, size_t start) | |||
2412 | } | 2422 | } |
2413 | } | 2423 | } |
2414 | } | 2424 | } |
2425 | |||
2415 | return wsp->ws_errno; | 2426 | return wsp->ws_errno; |
2416 | } | 2427 | } |
2417 | 2428 | ||