summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-02-22 06:34:43 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-02-22 06:34:43 -0800
commit1180a97cda1dab67169251eb8f50c1b076eeb1f4 (patch)
tree16febc2aaaf5352ea34a9d06afeaa5340e263d73
parent9c840f91af116b9d0d536f49696dda8da01cf6d9 (diff)
downloadtxr-1180a97cda1dab67169251eb8f50c1b076eeb1f4.tar.gz
txr-1180a97cda1dab67169251eb8f50c1b076eeb1f4.tar.bz2
txr-1180a97cda1dab67169251eb8f50c1b076eeb1f4.zip
remq/remove-if family: bugfixes in error message.
* lib.c (rem_impl): Take a name argument, so as to report correct function name. Also, serious fix here: we passed the address of the in function to the error message format job, rather than seq_in. (remove_if): Report as remove-if rather than remq in the error message. Also, same bug as in remq_impl: in used in place of seq_in. (remq, remql, remqual, keepq, keepql, keepqual): Pass function name as string into remq_impl.
-rw-r--r--lib.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib.c b/lib.c
index 22135f89..f7029785 100644
--- a/lib.c
+++ b/lib.c
@@ -1520,7 +1520,7 @@ val rmember_if(val pred, val list, val key)
return found;
}
-static val rem_impl(val (*eqfun)(val, val),
+static val rem_impl(val (*eqfun)(val, val), val name,
val obj, val seq_in, val keyfun_in)
{
val keyfun = default_bool_arg(keyfun_in);
@@ -1585,7 +1585,7 @@ static val rem_impl(val (*eqfun)(val, val),
return out;
}
default:
- uw_throwf(error_s, lit("remq: ~s isn't a sequence"), in, nao);
+ uw_throwf(error_s, lit("~a: ~s isn't a sequence"), name, seq_in, nao);
}
}
@@ -1653,39 +1653,39 @@ val remove_if(val pred, val seq_in, val keyfun_in)
return out;
}
default:
- uw_throwf(error_s, lit("remq: ~s isn't a sequence"), in, nao);
+ uw_throwf(error_s, lit("remove-if: ~s isn't a sequence"), seq_in, nao);
}
}
val remq(val obj, val seq, val keyfun)
{
- return rem_impl(eq, obj, seq, keyfun);
+ return rem_impl(eq, lit("remq"), obj, seq, keyfun);
}
val remql(val obj, val seq, val keyfun)
{
- return rem_impl(eql, obj, seq, keyfun);
+ return rem_impl(eql, lit("remq"), obj, seq, keyfun);
}
val remqual(val obj, val seq, val keyfun)
{
- return rem_impl(equal, obj, seq, keyfun);
+ return rem_impl(equal, lit("remqual"), obj, seq, keyfun);
}
val keepq(val obj, val seq, val keyfun)
{
- return rem_impl(neq, obj, seq, keyfun);
+ return rem_impl(neq, lit("keepq"), obj, seq, keyfun);
}
val keepql(val obj, val seq, val keyfun)
{
- return rem_impl(neql, obj, seq, keyfun);
+ return rem_impl(neql, lit("keepql"), obj, seq, keyfun);
}
val keepqual(val obj, val seq, val keyfun)
{
- return rem_impl(nequal, obj, seq, keyfun);
+ return rem_impl(nequal, lit("keepqual"), obj, seq, keyfun);
}
val keep_if(val pred, val seq, val keyfun)