From 389458021d4baa70a150021aa2d6ab02f78dccd2 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 23 Nov 2017 07:25:48 -0800 Subject: Fix quoted function name in unsupported object errors. * lib.c (unsup_obj): New static function. (grade, find, rfind, find_max, find_if, rfind_if, pos, rpos, pos_if, rpos_if, pos_max): Replace call to uw_throwf with call to unsup_obj. IN all these functions except grade, the ~s conversion specifier was wrongly used on the function name rather than ~a, resulting in unwanted quoting. --- lib.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib.c b/lib.c index def3d65c..bb9178a4 100644 --- a/lib.c +++ b/lib.c @@ -315,6 +315,12 @@ seq_info_t seq_info(val obj) return ret; } +static void noreturn unsup_obj(val self, val obj) +{ + uw_throwf(error_s, lit("~a: unsupported object ~s"), self, obj, nao); + abort(); +} + val throw_mismatch(val obj, type_t t) { type_mismatch(lit("~s is not of type ~s"), obj, code2type(t), nao); @@ -8423,7 +8429,7 @@ val grade(val seq, val lessfun, val keyfun_in) } break; default: - uw_throwf(error_s, lit("~a: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } { @@ -8495,7 +8501,7 @@ val find(val item, val seq, val testfun, val keyfun) } return nil; default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -8554,7 +8560,7 @@ val rfind(val item, val seq, val testfun, val keyfun) } return nil; default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -8629,7 +8635,7 @@ val find_max(val seq, val testfun, val keyfun) } case SEQ_NOTSEQ: default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -8690,7 +8696,7 @@ val find_if(val pred, val seq, val key) } case SEQ_NOTSEQ: default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } return nil; @@ -8748,7 +8754,7 @@ val rfind_if(val predi, val seq, val key) } case SEQ_NOTSEQ: default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } return found; @@ -8811,7 +8817,7 @@ val pos(val item, val seq, val testfun, val keyfun) } return nil; default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -8872,7 +8878,7 @@ val rpos(val item, val seq, val testfun, val keyfun) } return nil; default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -8945,7 +8951,7 @@ val pos_if(val pred, val seq, val key) } return nil; default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -8990,7 +8996,7 @@ val rpos_if(val pred, val seq, val key) return nil; } default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } @@ -9052,7 +9058,7 @@ val pos_max(val seq, val testfun, val keyfun) } case SEQ_NOTSEQ: default: - uw_throwf(error_s, lit("~s: unsupported object ~s"), self, seq, nao); + unsup_obj(self, seq); } } -- cgit v1.2.3