1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-20 11:33:09 -08:00

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.
This commit is contained in:
Pip Cet 2024-07-13 16:00:06 +00:00
parent fe6849068f
commit f4a12698d9
2 changed files with 19 additions and 1 deletions

View file

@ -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

View file

@ -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)