diff options
| author | Paul Eggert | 2015-04-19 08:53:35 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-04-19 08:55:36 -0700 |
| commit | 96bfe816d8107003dba7fd824c2ac2b999a84ae9 (patch) | |
| tree | 515ecdd0b9cd007a7b1a16c09ff69b6a8f46cd84 /src/eval.c | |
| parent | 65ac8bc6a9e256b60c8ddfa3c99a1b28145a0763 (diff) | |
| download | emacs-96bfe816d8107003dba7fd824c2ac2b999a84ae9.tar.gz emacs-96bfe816d8107003dba7fd824c2ac2b999a84ae9.zip | |
Refactor low-level printing for simplicity
* src/print.c (PRINTDECLARE): Remove. Move its contents into
PRINTPREPARE; doable now that we assume C99. All callers changed.
(PRINTCHAR): Remove, as it adds more mystery than clarity.
All callers changed.
(strout): Assume that caller computes length. All callers changed.
(print_c_string): New function.
(write_string, write_string_1): Compute length instead of asking
the caller to compute it. All callers changed.
(write_string): Simplify by using write_string_1.
(write_string_1): Simplify by using print_c_string.
(Fterpri): Compute default val more clearly.
(Fprin1_to_string, print_object):
Assume C99 to avoid unnecessary nesting.
(print_object): Prefer print_c_string to multiple printchar, or
to calling strout with -1 length. Coalesce into sprintf when
this is easy.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c index 11d08895c37..490226149ff 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -3305,27 +3305,27 @@ Output stream used is value of `standard-output'. */) | |||
| 3305 | 3305 | ||
| 3306 | while (backtrace_p (pdl)) | 3306 | while (backtrace_p (pdl)) |
| 3307 | { | 3307 | { |
| 3308 | write_string (backtrace_debug_on_exit (pdl) ? "* " : " ", 2); | 3308 | write_string (backtrace_debug_on_exit (pdl) ? "* " : " "); |
| 3309 | if (backtrace_nargs (pdl) == UNEVALLED) | 3309 | if (backtrace_nargs (pdl) == UNEVALLED) |
| 3310 | { | 3310 | { |
| 3311 | Fprin1 (Fcons (backtrace_function (pdl), *backtrace_args (pdl)), | 3311 | Fprin1 (Fcons (backtrace_function (pdl), *backtrace_args (pdl)), |
| 3312 | Qnil); | 3312 | Qnil); |
| 3313 | write_string ("\n", -1); | 3313 | write_string ("\n"); |
| 3314 | } | 3314 | } |
| 3315 | else | 3315 | else |
| 3316 | { | 3316 | { |
| 3317 | tem = backtrace_function (pdl); | 3317 | tem = backtrace_function (pdl); |
| 3318 | Fprin1 (tem, Qnil); /* This can QUIT. */ | 3318 | Fprin1 (tem, Qnil); /* This can QUIT. */ |
| 3319 | write_string ("(", -1); | 3319 | write_string ("("); |
| 3320 | { | 3320 | { |
| 3321 | ptrdiff_t i; | 3321 | ptrdiff_t i; |
| 3322 | for (i = 0; i < backtrace_nargs (pdl); i++) | 3322 | for (i = 0; i < backtrace_nargs (pdl); i++) |
| 3323 | { | 3323 | { |
| 3324 | if (i) write_string (" ", -1); | 3324 | if (i) write_string (" "); |
| 3325 | Fprin1 (backtrace_args (pdl)[i], Qnil); | 3325 | Fprin1 (backtrace_args (pdl)[i], Qnil); |
| 3326 | } | 3326 | } |
| 3327 | } | 3327 | } |
| 3328 | write_string (")\n", -1); | 3328 | write_string (")\n"); |
| 3329 | } | 3329 | } |
| 3330 | pdl = backtrace_next (pdl); | 3330 | pdl = backtrace_next (pdl); |
| 3331 | } | 3331 | } |