diff options
author | Michael Gran <spk121@yahoo.com> | 2009-08-20 20:30:12 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-08-20 21:39:56 -0700 |
commit | 0193377d24db3ec57ea9be488069a4b86878e6e6 (patch) | |
tree | b61bdf868d4e3cedd05ec45827d011a826dfa1cc /libguile/error.c | |
parent | 7f5946427e457b5588b1a5103dc4652bd9a99392 (diff) | |
download | guile-0193377d24db3ec57ea9be488069a4b86878e6e6.tar.gz |
Avoid accessing symbol internals in call_dsubr_1 and DEVAL
The symbol's characters are only accessed in case they are needed
for an error message. This can be avoided by passing the symbol
all the way to a error message function.
* libguile/__scm.h (SCM_WTA_DISPATCH_1_SUBR): new macro
* libguile/error.c (scm_i_wrong_type_arg_symbol): new error function
* libguile/error.h: declaration of scm_i_wrong_type_arg_symbol
* libguile/eval.c (call_dsubr_1): use new macro SCM_WTA_DISPATCH_1_SUBR
to avoid having to unpack the symbol's chars
* libguile/eval.i.c: use new macro SCM_WTA_DISPATCH_1_SUBR
Diffstat (limited to 'libguile/error.c')
-rw-r--r-- | libguile/error.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libguile/error.c b/libguile/error.c index eb513a74a..bcbcd9cd1 100644 --- a/libguile/error.c +++ b/libguile/error.c @@ -233,6 +233,19 @@ scm_wrong_type_arg (const char *subr, int pos, SCM bad_value) } void +scm_i_wrong_type_arg_symbol (SCM symbol, int pos, SCM bad_value) +{ + scm_error_scm (scm_arg_type_key, + scm_symbol_to_string (symbol), + (pos == 0) ? scm_from_locale_string ("Wrong type: ~S") + : scm_from_locale_string ("Wrong type argument in position ~A: ~S"), + (pos == 0) ? scm_list_1 (bad_value) + : scm_list_2 (scm_from_int (pos), bad_value), + scm_list_1 (bad_value)); + scm_remember_upto_here_2 (symbol, bad_value); +} + +void scm_wrong_type_arg_msg (const char *subr, int pos, SCM bad_value, const char *szMessage) { SCM msg = scm_from_locale_string (szMessage); |