diff options
| author | Eli Zaretskii | 2022-09-13 16:26:50 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-09-13 16:26:50 +0300 |
| commit | dfbe745ed9ba89e516ef89955f2ca88be04d1d72 (patch) | |
| tree | 9f9cbb9ed325cbf5b59937c6cc32745c15f66b64 /src | |
| parent | aac4965702d3d8c665e13e8c8c7f6fb229b05097 (diff) | |
| download | emacs-dfbe745ed9ba89e516ef89955f2ca88be04d1d72.tar.gz emacs-dfbe745ed9ba89e516ef89955f2ca88be04d1d72.zip | |
Fix last change in image.c
* src/image.c (svg_load_image): Don't call Lisp to remove trailing
whitespace from librsvg error messages, do it in C instead; this
reduces consing and is much cleaner. Don't display empty error
reason if librsvg happens to return an empty message text.
(syms_of_image): Don't DEFSYM string-trim-right. (Bug#57755)
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/image.c b/src/image.c index 2e04685e7f9..b1d597d7213 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -11540,13 +11540,18 @@ svg_load_image (struct frame *f, struct image *img, char *contents, | |||
| 11540 | return true; | 11540 | return true; |
| 11541 | 11541 | ||
| 11542 | rsvg_error: | 11542 | rsvg_error: |
| 11543 | if (err == NULL) | 11543 | if (!err || !err->message[0]) |
| 11544 | image_error ("Error parsing SVG image"); | 11544 | image_error ("Error parsing SVG image"); |
| 11545 | else | 11545 | else |
| 11546 | { | 11546 | { |
| 11547 | image_error ("Error parsing SVG image: %s", | 11547 | char *errmsg = err->message; |
| 11548 | call2 (Qstring_trim_right, build_string (err->message), | 11548 | ptrdiff_t errlen = strlen (errmsg); |
| 11549 | Qnil)); | 11549 | |
| 11550 | /* Remove trailing whitespace from the error message text. It | ||
| 11551 | has a newline at the end, and perhaps more whitespace. */ | ||
| 11552 | while (c_isspace (errmsg[errlen - 1])) | ||
| 11553 | errlen--; | ||
| 11554 | image_error ("Error parsing SVG image: %s", make_string (errmsg, errlen)); | ||
| 11550 | g_error_free (err); | 11555 | g_error_free (err); |
| 11551 | } | 11556 | } |
| 11552 | 11557 | ||
| @@ -12272,6 +12277,4 @@ The options are: | |||
| 12272 | /* MagickExportImagePixels is in 6.4.6-9, but not 6.4.4-10. */ | 12277 | /* MagickExportImagePixels is in 6.4.6-9, but not 6.4.4-10. */ |
| 12273 | imagemagick_render_type = 0; | 12278 | imagemagick_render_type = 0; |
| 12274 | #endif | 12279 | #endif |
| 12275 | |||
| 12276 | DEFSYM (Qstring_trim_right, "string-trim-right"); | ||
| 12277 | } | 12280 | } |