diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-06-25 07:17:48 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-06-25 07:17:48 -0700 |
commit | 90bda5c939db3a65a7c9dc1347855b4a1def1f0a (patch) | |
tree | e92f955f30086e2fc2a9bc4ed135e10e2682c191 /lib.c | |
parent | f30990943abba9a73bf0f2396c996c612e7862d3 (diff) | |
download | txr-90bda5c939db3a65a7c9dc1347855b4a1def1f0a.tar.gz txr-90bda5c939db3a65a7c9dc1347855b4a1def1f0a.tar.bz2 txr-90bda5c939db3a65a7c9dc1347855b4a1def1f0a.zip |
Handle buffers in list collector functions.
* lib.c (nullify, list_collect, list_collect_nconc,
list_collect_append, list_collect_nreconc,
list_collect_revappend): Handle buffer type.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1008,6 +1008,8 @@ val nullify(val seq) return if3(length_str_gt(seq, zero), seq, nil); case VEC: return if3(length_vec(seq) != zero, seq, nil); + case BUF: + return if3(length_buf(seq) != zero, seq, nil); case COBJ: if (obj_struct_p(seq)) { val nullify_meth = maybe_slot(seq, nullify_s); @@ -1047,6 +1049,9 @@ loc list_collect(loc ptail, val obj) case LSTR: replace_str(tailobj, items, t, t); return ptail; + case BUF: + replace_buf(tailobj, items, t, t); + return ptail; case COBJ: if (tailobj->co.cls == carray_s) { carray_replace(tailobj, items, t, t); @@ -1082,6 +1087,9 @@ loc list_collect_nconc(loc ptail, val obj) case LSTR: replace_str(tailobj, obj, t, t); return ptail; + case BUF: + replace_buf(tailobj, obj, t, t); + return ptail; case COBJ: set(ptail, tolist(tailobj)); ptail = tail(deref(ptail)); @@ -1117,6 +1125,10 @@ loc list_collect_append(loc ptail, val obj) set(ptail, copy_str(tailobj)); replace_str(deref(ptail), obj, t, t); return ptail; + case BUF: + set(ptail, copy_buf(tailobj)); + replace_buf(deref(ptail), obj, t, t); + return ptail; case COBJ: set(ptail, tolist(tailobj)); ptail = tail(deref(ptail)); @@ -1154,6 +1166,9 @@ loc list_collect_nreconc(loc ptail, val obj) case LSTR: replace_str(tailobj, rev, t, t); return ptail; + case BUF: + replace_buf(tailobj, obj, t, t); + return ptail; default: uw_throwf(error_s, lit("cannot nconc ~s to ~s"), obj, tailobj, nao); } @@ -1214,6 +1229,10 @@ loc list_collect_revappend(loc ptail, val obj) set(ptail, copy_str(tailobj)); replace_str(deref(ptail), reverse(obj), t, t); return ptail; + case BUF: + set(ptail, copy_buf(tailobj)); + replace_buf(deref(ptail), reverse(obj), t, t); + return ptail; default: uw_throwf(error_s, lit("cannot append to ~s"), tailobj, nao); } |