emacs-diffs
[Top][All Lists]
Advanced

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

scratch/igc 3116248be22: Trace OpenTypeSpec in macfont.m


From: Gerd Moellmann
Subject: scratch/igc 3116248be22: Trace OpenTypeSpec in macfont.m
Date: Sun, 28 Jul 2024 09:11:25 -0400 (EDT)

branch: scratch/igc
commit 3116248be221dfe9af65cabdf299bbf6b3c7cbad
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    Trace OpenTypeSpec in macfont.m
    
    * src/macfont.m (macfont_get_open_type_spec): Use
    igc_xzalloc_ambig. Also use xfree where appropriate.
    (macfont_create_attributes_with_spec): Use igc_xfree and xfree as
    needed.
---
 src/macfont.m | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/macfont.m b/src/macfont.m
index e3b3d40df43..c3f56f5a064 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -22,6 +22,7 @@ Original author: YAMAMOTO Mitsuharu
 #include <config.h>
 
 #include "lisp.h"
+#include "igc.h"
 #include "dispextern.h"
 #include "frame.h"
 #include "blockinput.h"
@@ -1884,13 +1885,15 @@ struct OpenTypeSpec
 static struct OpenTypeSpec *
 macfont_get_open_type_spec (Lisp_Object otf_spec)
 {
+#ifdef HAVE_MPS
+  struct OpenTypeSpec *spec = igc_xzalloc_ambig (sizeof *spec);
+#else
   struct OpenTypeSpec *spec = xmalloc (sizeof *spec);
+#endif
   Lisp_Object val;
   int i, j;
   bool negative;
 
-  if (! spec)
-    return NULL;
   spec->script = XCAR (otf_spec);
   if (! NILP (spec->script))
     {
@@ -1927,7 +1930,11 @@ macfont_get_open_type_spec (Lisp_Object otf_spec)
         {
           if (i > 0 && spec->features[0])
             free (spec->features[0]);
-          free (spec);
+#ifdef HAVE_MPS
+          igc_xfree (spec);
+#else
+          xfree (spec);
+#endif
           return NULL;
         }
       for (j = 0, negative = 0; CONSP (val); val = XCDR (val))
@@ -2180,7 +2187,11 @@ macfont_create_attributes_with_spec (Lisp_Object spec)
         free (otspec->features[0]);
       if (otspec->nfeatures[1] > 0)
         free (otspec->features[1]);
-      free (otspec);
+#ifdef HAVE_MPS
+      igc_xfree (otspec);
+#else
+      xfree (otspec);
+#endif
     }
 
   return attributes;



reply via email to

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