[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android bd5532e0db5: Update Android port
From: |
Po Lu |
Subject: |
feature/android bd5532e0db5: Update Android port |
Date: |
Mon, 31 Jul 2023 08:34:20 -0400 (EDT) |
branch: feature/android
commit bd5532e0db53ad6c9842213507dfa6b958051f57
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Update Android port
* src/sfnt.c (ISECT): Micro-optimize this instruction.
* src/sfntfont.c (sfnt_parse_style): Avoid GC safety problem.
---
src/sfnt.c | 12 +++++++-----
src/sfntfont.c | 9 ++++++---
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/sfnt.c b/src/sfnt.c
index 10321a09c8b..3f1639b3734 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -7019,11 +7019,13 @@ sfnt_interpret_trap (struct sfnt_interpreter
*interpreter,
{ \
uint32_t a0, a1, b0, b1, p; \
\
- a0 = POP (); \
- a1 = POP (); \
- b0 = POP (); \
- b1 = POP (); \
- p = POP (); \
+ CHECK_STACK_ELEMENTS (5); \
+ \
+ a0 = POP_UNCHECKED (); \
+ a1 = POP_UNCHECKED (); \
+ b0 = POP_UNCHECKED (); \
+ b1 = POP_UNCHECKED (); \
+ p = POP_UNCHECKED (); \
\
sfnt_interpret_isect (interpreter, \
a0, a1, b0, b1, p); \
diff --git a/src/sfntfont.c b/src/sfntfont.c
index 72434d5b5d8..6927b185721 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -453,6 +453,7 @@ sfnt_parse_style (Lisp_Object style_name, struct
sfnt_font_desc *desc)
{
char *style, *single, *saveptr;
int i;
+ USE_SAFE_ALLOCA;
/* Fill in default values. slant seems to not be consistent with
Fontconfig. */
@@ -462,9 +463,9 @@ sfnt_parse_style (Lisp_Object style_name, struct
sfnt_font_desc *desc)
/* Split the style into tokens delimited by spaces. Attempt to find
a token specifying each of the weight, slant, or width attributes
- using their respective descriptions arrays as a reference. GC
- must not happen inside this block. */
- style = SSDATA (Fdowncase (style_name));
+ using their respective descriptions arrays as a reference. */
+
+ SAFE_ALLOCA_STRING (style, Fdowncase (style_name));
saveptr = NULL;
while ((single = strtok_r (style, " ", &saveptr)))
@@ -541,6 +542,8 @@ sfnt_parse_style (Lisp_Object style_name, struct
sfnt_font_desc *desc)
next:
continue;
}
+
+ SAFE_FREE ();
}
/* Parse the list of design languages in META, a font metadata table,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/android bd5532e0db5: Update Android port,
Po Lu <=