[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master dfbe745ed9: Fix last change in image.c
From: |
Eli Zaretskii |
Subject: |
master dfbe745ed9: Fix last change in image.c |
Date: |
Tue, 13 Sep 2022 09:27:42 -0400 (EDT) |
branch: master
commit dfbe745ed9ba89e516ef89955f2ca88be04d1d72
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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)
---
src/image.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/image.c b/src/image.c
index 2e04685e7f..b1d597d721 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11540,13 +11540,18 @@ svg_load_image (struct frame *f, struct image *img,
char *contents,
return true;
rsvg_error:
- if (err == NULL)
+ if (!err || !err->message[0])
image_error ("Error parsing SVG image");
else
{
- image_error ("Error parsing SVG image: %s",
- call2 (Qstring_trim_right, build_string (err->message),
- Qnil));
+ char *errmsg = err->message;
+ ptrdiff_t errlen = strlen (errmsg);
+
+ /* Remove trailing whitespace from the error message text. It
+ has a newline at the end, and perhaps more whitespace. */
+ while (c_isspace (errmsg[errlen - 1]))
+ errlen--;
+ image_error ("Error parsing SVG image: %s", make_string (errmsg,
errlen));
g_error_free (err);
}
@@ -12272,6 +12277,4 @@ The options are:
/* MagickExportImagePixels is in 6.4.6-9, but not 6.4.4-10. */
imagemagick_render_type = 0;
#endif
-
- DEFSYM (Qstring_trim_right, "string-trim-right");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master dfbe745ed9: Fix last change in image.c,
Eli Zaretskii <=