emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/igc f4a12698d9e 4/7: Use IGC routines for some allocations in An


From: Pip Cet
Subject: scratch/igc f4a12698d9e 4/7: Use IGC routines for some allocations in Android port
Date: Sat, 13 Jul 2024 14:58:30 -0400 (EDT)

branch: scratch/igc
commit f4a12698d9e152ecf06524fb5722e14bbf8bc2f7
Author: Pip Cet <pipcet@protonmail.com>
Commit: Pip Cet <pipcet@protonmail.com>

    Use IGC routines for some allocations in Android port
    
    * src/androidterm.c (color_map): New static
    variable.
    (android_term_init): Use `igc_xzalloc_ambig', staticpro `color_map'.
    (mark_androidterm): Conditionalize on !HAVE_MPS.
    * src/sfntfont.c (sfnt_enum_font_1): Use `igc_xzalloc_ambig'.
    (mark_sfntfont): Conditionalize on !HAVE_MPS.
---
 src/androidterm.c | 12 +++++++++++-
 src/sfntfont.c    |  8 ++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/androidterm.c b/src/androidterm.c
index 4561f2d1df3..48627b08a7e 100644
--- a/src/androidterm.c
+++ b/src/androidterm.c
@@ -35,6 +35,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "pdumper.h"
 #include "keymap.h"
 
+#include "igc.h"
+
 /* This is a chain of structures for all the X displays currently in
    use.  */
 
@@ -6613,14 +6615,19 @@ android_create_terminal (struct android_display_info 
*dpyinfo)
 /* Initialize the Android terminal interface.  The display connection
    has already been set up by the system at this point.  */
 
+static Lisp_Object color_map;
 void
 android_term_init (void)
 {
   struct terminal *terminal;
   struct android_display_info *dpyinfo;
-  Lisp_Object color_file, color_map;
+  Lisp_Object color_file;
 
+#ifdef HAVE_MPS
+  dpyinfo = igc_xzalloc_ambig (sizeof *dpyinfo);
+#else
   dpyinfo = xzalloc (sizeof *dpyinfo);
+#endif
   terminal = android_create_terminal (dpyinfo);
   terminal->kboard = allocate_kboard (Qandroid);
   terminal->kboard->reference_count++;
@@ -6642,6 +6649,7 @@ android_term_init (void)
     fatal ("Could not read %s.\n", SDATA (color_file));
 
   dpyinfo->color_map = color_map;
+  staticpro (&color_map);
 
 #ifndef ANDROID_STUBIFY
   dpyinfo->resx = android_pixel_density_x;
@@ -6926,9 +6934,11 @@ for instance, `early-init.el', or they will be of no 
effect.  */);
   DEFSYM (Qreturn, "return");
 }
 
+#ifndef HAVE_MPS
 void
 mark_androidterm (void)
 {
   if (x_display_list)
     mark_object (x_display_list->color_map);
 }
+#endif
diff --git a/src/sfntfont.c b/src/sfntfont.c
index cb94a13642e..d969ed112d3 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -41,6 +41,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 /* For FRAME_FONT.  */
 #include TERM_HEADER
 
+#include "igc.h"
+
 /* Generic font driver for sfnt-based fonts (currently TrueType, but
    it would be easy to add CFF support in the future with a PostScript
    renderer.)
@@ -989,7 +991,11 @@ sfnt_enum_font_1 (int fd, const char *file,
   char buffer[5];
 
   /* Create the font desc and copy in the file name.  */
+#ifdef HAVE_MPS
+  desc = igc_xzalloc_ambig (sizeof *desc + strlen (file) + 1);
+#else
   desc = xzalloc (sizeof *desc + strlen (file) + 1);
+#endif
   desc->path = (char *) (desc + 1);
   memcpy (desc->path, file, strlen (file) + 1);
   desc->offset = offset;
@@ -4196,6 +4202,7 @@ are slow.  */);
   sfnt_raster_glyphs_exactly = true;
 }
 
+#ifndef HAVE_MPS
 void
 mark_sfntfont (void)
 {
@@ -4214,6 +4221,7 @@ mark_sfntfont (void)
       mark_object (desc->designer);
     }
 }
+#endif
 
 void
 init_sfntfont (void)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]