From 0b4ab8b77253717df4d35572d45381af9c6ce6c5 Mon Sep 17 00:00:00 2001 From: Charlie Cummings Date: Wed, 28 Oct 2015 01:27:24 -0400 Subject: [PATCH] fix ++lore and ++role --- jets/e/lore.c | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/jets/e/lore.c b/jets/e/lore.c index 9a6e553fef..13fa3c1d3d 100644 --- a/jets/e/lore.c +++ b/jets/e/lore.c @@ -12,33 +12,40 @@ u3_noun tez = u3_nul; while ( 1 ) { - c3_w meg_w; + c3_w meg_w = 0; + c3_y end_y; - if ( pos_w >= len_w ) { - return u3kb_flop(tez); - } else { - meg_w = 0; - - c3_y byt_y; - while ( 1 ) { - byt_y = u3r_byte(pos_w + meg_w, lub); - - if ( (10 == byt_y) || (0 == byt_y) ) { - break; - } else meg_w++; + c3_y byt_y; + while ( 1 ) { + if ( pos_w >= len_w ) { + byt_y = 0; + end_y = c3y; + break; } + byt_y = u3r_byte(pos_w + meg_w, lub); - if ((byt_y == 0) && ((pos_w + meg_w + 1) < len_w)) { - return u3m_bail(c3__exit); + if ( (10 == byt_y) || (0 == byt_y) ) { + end_y = __(byt_y == 0); + break; + } else meg_w++; + } + + if ((byt_y == 0) && ((pos_w + meg_w + 1) < len_w)) { + return u3m_bail(c3__exit); + } + + { + c3_y* byts_y = alloca(meg_w); + u3r_bytes(pos_w, meg_w, byts_y, lub); + + if ( _(end_y) ) { + return u3kb_flop(u3nc(u3i_bytes(meg_w, byts_y), tez)); } - - { - c3_y* byts_y = alloca(meg_w); - - u3r_bytes(pos_w, meg_w, byts_y, lub); - tez = u3nc(u3i_bytes(meg_w, byts_y), tez); - pos_w += (meg_w + 1); + if ( pos_w >= len_w ) { + return u3kb_flop(tez); } + tez = u3nc(u3i_bytes(meg_w, byts_y), tez); + pos_w += (meg_w + 1); } } }