From 3c70f2ff18650c4794556049cd4ea22a58cc719e Mon Sep 17 00:00:00 2001 From: Christophe Troestler Date: Sun, 27 Sep 2020 23:20:52 +0200 Subject: [PATCH] Do not store the Caml_ba_array_val pointer during surface creation Extracted from Cairo git-tree on November 22, 2020 by Brett Gilio --- src/cairo_stubs.c | 3 ++- tests/image_create.ml | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cairo_stubs.c b/src/cairo_stubs.c index 641ee2c..200abf3 100644 --- a/src/cairo_stubs.c +++ b/src/cairo_stubs.c @@ -1580,6 +1580,7 @@ static cairo_status_t caml_cairo_image_bigarray_attach_proxy caml_cairo_image_bigarray_finalize); } +#define b (Caml_ba_array_val(vb)) #define SURFACE_CREATE_DATA(name) \ CAMLexport value caml_cairo_image_surface_create_for_##name \ (value vb, value vformat, value vwidth, value vheight, value vstride) \ @@ -1588,7 +1589,6 @@ static cairo_status_t caml_cairo_image_bigarray_attach_proxy CAMLlocal1(vsurf); \ cairo_surface_t* surf; \ const int width = Int_val(vwidth); \ - struct caml_ba_array *b = Caml_ba_array_val(vb); \ cairo_status_t status; \ \ if ((b->flags & CAML_BA_MANAGED_MASK) == CAML_BA_MAPPED_FILE) \ @@ -1610,6 +1610,7 @@ static cairo_status_t caml_cairo_image_bigarray_attach_proxy SURFACE_CREATE_DATA(data8) SURFACE_CREATE_DATA(data32) +#undef b #define SURFACE_GET_DATA(type, num_dims, dims ...) \ CAMLexport value caml_cairo_image_surface_get_##type(value vsurf) \ diff --git a/tests/image_create.ml b/tests/image_create.ml index eec98d6..b13c206 100644 --- a/tests/image_create.ml +++ b/tests/image_create.ml @@ -10,6 +10,7 @@ let create() = let () = let cr = create() in + printf "With Cairo handle:\n%!"; set_source_rgb cr 1. 1. 1.; rectangle cr 0. 0. ~w:300. ~h:300.; fill cr; @@ -21,9 +22,9 @@ let () = show_text cr "Hello"; Gc.compact(); Gc.compact(); - eprintf "Write image\n%!"; + eprintf "- Write image\n%!"; PNG.write (get_target cr) "test_image.png"; - eprintf "Finish surface\n%!"; + eprintf "- Finish surface\n%!"; Surface.finish (get_target cr); Gc.compact() -- 2.29.2 '/guix/commit/gnu/packages.scm?id=635d49f97ee233bbb2673f97d7556c3c91b55889'>packages: Use SRFI-71 instead of SRFI-11....* gnu/packages.scm (%package-module-path): Use 'let*' instead of 'let*-values'. (specification->package, specification->location) (specification->package+output): Use 'let' instead of 'let-values'. Ludovic Courtès 2022-06-06packages: Add 'specifications->packages'....* gnu/packages.scm (specifications->packages): New procedure. * guix/scripts/home/import.scm (manifest+configuration-files->code): Use it. * tests/home-import.scm (match-home-environment-no-services) (match-home-environment-no-services-nor-packages) (match-home-environment-bash-service) (match-home-environment-bash-service-with-alias): Adjust 'packages' field accordingly. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Antero Mejr 2022-04-04packages: Add 'package-unique-version-prefix'....* gnu/packages.scm (package-unique-version-prefix): New procedure. * guix/scripts/package.scm (manifest-entry-version-prefix): Use it. * tests/packages.scm ("package-unique-version-prefix, gcc@8") ("package-unique-version-prefix, grep"): New tests. Ludovic Courtès 2022-01-11shell: Cache profiles even when using package specs....This enables profile caching not just when '-m' or '-f' is used, but also when package specs are passed on the command line, as in: guix shell -D guix git It also changes profile cache keys to include the system type, which was previously ignored. * guix/scripts/shell.scm (options-with-caching)[single-file-for-caching]: Remove. Call 'profile-cached-gc-root' instead; adjust to accept two values. (profile-cache-primary-key): New procedure. (profile-cache-key): Remove. (profile-file-cache-key, profile-spec-cache-key): New procedures. (profile-cached-gc-root): Rewrite to include functionality formally in 'single-file-for-caching', but extend to handle package specs. * gnu/packages.scm (cache-is-authoritative?): Export. * guix/transformations.scm (transformation-option-key?): New procedure. * doc/guix.texi (Invoking guix shell): Move '--rebuild-cache' documentation to the bottom, just above '--root'. Explain caching and how these two options relate to that. Ludovic Courtès