summaryrefslogtreecommitdiff
path: root/src/hbfont.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-08-15 10:48:36 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-08-15 11:19:51 -0700
commitf1b06fd5fc66377f85b420d3d40c666da9dca2a5 (patch)
tree588b05ababc36aaec1d28f6543aa35b180cba79c /src/hbfont.c
parentd0145537fa511a44e2a4af01da3947e92f0b8331 (diff)
downloademacs-f1b06fd5fc66377f85b420d3d40c666da9dca2a5.tar.gz
emacs-f1b06fd5fc66377f85b420d3d40c666da9dca2a5.tar.bz2
emacs-f1b06fd5fc66377f85b420d3d40c666da9dca2a5.zip
Prefer Fvector to make_uninit_vector
Fvector is less error-prone than make_uninit_vector, as it avoids the possibility of a GC crash due to an uninitialized vector. So prefer Fvector to make_uninit_vector when this is easy (and when there's no significant performance difference). Inspired by a suggestion by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00313.html * src/ccl.c (Fregister_ccl_program): * src/ccl.c (Fregister_ccl_program): * src/charset.c (Fdefine_charset_internal): * src/font.c (Fquery_font, Ffont_info, syms_of_font): * src/fontset.c (font_def_new, Fset_fontset_font): * src/ftfont.c (ftfont_shape_by_flt): * src/hbfont.c (hbfont_shape): * src/macfont.m (macfont_shape): * src/search.c (Fnewline_cache_check): * src/xfaces.c (Fx_family_fonts): * src/xfns.c (Fx_window_property_attributes): Prefer Fvector to make_uninit_vector when either is easy. * src/fontset.c (font_def_new): Now a function with one less arg instead of a do-while macro, and renamed from FONT_DEF_NEW. All uses changed.
Diffstat (limited to 'src/hbfont.c')
-rw-r--r--src/hbfont.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/hbfont.c b/src/hbfont.c
index 4b3f64ef504..82b115e6868 100644
--- a/src/hbfont.c
+++ b/src/hbfont.c
@@ -594,13 +594,10 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction)
yoff = - lround (pos[i].y_offset * position_unit);
wadjust = lround (pos[i].x_advance * position_unit);
if (xoff || yoff || wadjust != metrics.width)
- {
- Lisp_Object vec = make_uninit_vector (3);
- ASET (vec, 0, make_fixnum (xoff));
- ASET (vec, 1, make_fixnum (yoff));
- ASET (vec, 2, make_fixnum (wadjust));
- LGLYPH_SET_ADJUSTMENT (lglyph, vec);
- }
+ LGLYPH_SET_ADJUSTMENT (lglyph, CALLN (Fvector,
+ make_fixnum (xoff),
+ make_fixnum (yoff),
+ make_fixnum (wadjust)));
}
return make_fixnum (glyph_len);