From 748b19e56e87fab44cb5474613502f8e96064a46 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Sun, 1 Dec 2024 13:50:05 +0100 Subject: Update to version 2.58 of librsvg API (bug#74606) * src/image.c (init_svg_functions): Declare new function. (svg_load_image): Use it. --- src/image.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/image.c b/src/image.c index 0b590faab76..ed680be54dd 100644 --- a/src/image.c +++ b/src/image.c @@ -11655,7 +11655,11 @@ DEF_DLL_FN (void, rsvg_handle_get_dimensions, DEF_DLL_FN (gboolean, rsvg_handle_set_stylesheet, (RsvgHandle *, const guint8 *, gsize, GError **)); # endif +# if LIBRSVG_CHECK_VERSION (2, 58, 0) +DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf_and_error, (RsvgHandle *, GError **)); +# else DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *)); +# endif DEF_DLL_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *)); DEF_DLL_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *)); DEF_DLL_FN (guchar *, gdk_pixbuf_get_pixels, (const GdkPixbuf *)); @@ -11714,8 +11718,11 @@ init_svg_functions (void) #if LIBRSVG_CHECK_VERSION (2, 48, 0) LOAD_DLL_FN (library, rsvg_handle_set_stylesheet); #endif +#if LIBRSVG_CHECK_VERSION (2, 58, 0) + LOAD_DLL_FN (library, rsvg_handle_get_pixbuf_and_error); +#else LOAD_DLL_FN (library, rsvg_handle_get_pixbuf); - +#endif LOAD_DLL_FN (gdklib, gdk_pixbuf_get_width); LOAD_DLL_FN (gdklib, gdk_pixbuf_get_height); LOAD_DLL_FN (gdklib, gdk_pixbuf_get_pixels); @@ -11760,7 +11767,11 @@ init_svg_functions (void) # if LIBRSVG_CHECK_VERSION (2, 48, 0) # undef rsvg_handle_set_stylesheet # endif -# undef rsvg_handle_get_pixbuf +# if LIBRSVG_CHECK_VERSION (2, 58, 0) +# undef rsvg_handle_get_pixbuf_and_error +# else +# undef rsvg_handle_get_pixbuf +# endif # if LIBRSVG_CHECK_VERSION (2, 32, 0) # undef g_file_new_for_path # undef g_memory_input_stream_new_from_data @@ -11801,7 +11812,11 @@ init_svg_functions (void) # if LIBRSVG_CHECK_VERSION (2, 48, 0) # define rsvg_handle_set_stylesheet fn_rsvg_handle_set_stylesheet # endif -# define rsvg_handle_get_pixbuf fn_rsvg_handle_get_pixbuf +# if LIBRSVG_CHECK_VERSION (2, 58, 0) +# define rsvg_handle_get_pixbuf_and_error fn_rsvg_handle_get_pixbuf_and_error +# else +# define rsvg_handle_get_pixbuf fn_rsvg_handle_get_pixbuf +# endif # if LIBRSVG_CHECK_VERSION (2, 32, 0) # define g_file_new_for_path fn_g_file_new_for_path # define g_memory_input_stream_new_from_data \ @@ -12306,8 +12321,13 @@ svg_load_image (struct frame *f, struct image *img, char *contents, /* We can now get a valid pixel buffer from the svg file, if all went ok. */ +#if LIBRSVG_CHECK_VERSION (2, 58, 0) + pixbuf = rsvg_handle_get_pixbuf_and_error (rsvg_handle, &err); + if (err) goto rsvg_error; +#else pixbuf = rsvg_handle_get_pixbuf (rsvg_handle); if (!pixbuf) goto rsvg_error; +#endif g_object_unref (rsvg_handle); xfree (wrapped_contents); -- cgit v1.2.1 From 3c7687c1dd136fa535e22262f78fdfadbbf73105 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 29 Nov 2024 16:33:28 -0800 Subject: Allow passing nil to treesit-node-match-p (bug#74612) * src/treesit.c (Ftreesit_node_match_p): Return nil if NODE is nil. --- src/treesit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/treesit.c b/src/treesit.c index 4031d80f7c9..cda6d4af2ee 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -4017,7 +4017,8 @@ PREDICATE can be a symbol representing a thing in `treesit-thing-settings', or a predicate, like regexp matching node type, etc. See `treesit-thing-settings' for more details. -Return non-nil if NODE matches PREDICATE, nil otherwise. +Return non-nil if NODE matches PREDICATE, nil otherwise. If NODE is +nil, return nil. Signals `treesit-invalid-predicate' if there's no definition of THING in `treesit-thing-settings', or if PREDICATE is malformed. If @@ -4025,6 +4026,8 @@ IGNORE-MISSING is non-nil, don't signal an error for missing THING definition, but still signal for malformed PREDICATE. */) (Lisp_Object node, Lisp_Object predicate, Lisp_Object ignore_missing) { + if (NILP (node)) return Qnil; + CHECK_TS_NODE (node); Lisp_Object parser = XTS_NODE (node)->parser; -- cgit v1.2.1