From 684288f32f2ecbb4ae648fc6b6df942603ec8629 Mon Sep 17 00:00:00 2001 From: Oleg Oshmyan Date: Mon, 6 Jul 2020 02:00:27 +0300 Subject: shaper: drop prealloc parameter of ass_shaper_new The only prealloc value actually used is 0, which is not useful and invokes implementation-defined (and potentially obsolescent as per C11 DR400) behavior. --- libass/ass_render.c | 2 +- libass/ass_shaper.c | 7 ++----- libass/ass_shaper.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index 40ee3d1..7bc9554 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -108,7 +108,7 @@ ASS_Renderer *ass_renderer_init(ASS_Library *library) priv->settings.font_size_coeff = 1.; priv->settings.selective_style_overrides = ASS_OVERRIDE_BIT_SELECTIVE_FONT_SCALE; - if (!(priv->shaper = ass_shaper_new(0))) + if (!(priv->shaper = ass_shaper_new())) goto fail; ass_shaper_info(library); diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c index 80e78aa..171704b 100644 --- a/libass/ass_shaper.c +++ b/libass/ass_shaper.c @@ -947,18 +947,15 @@ int ass_shaper_shape(ASS_Shaper *shaper, TextInfo *text_info) } /** - * \brief Create a new shaper instance and preallocate data structures - * \param prealloc preallocation size + * \brief Create a new shaper instance */ -ASS_Shaper *ass_shaper_new(size_t prealloc) +ASS_Shaper *ass_shaper_new(void) { ASS_Shaper *shaper = calloc(sizeof(*shaper), 1); if (!shaper) return NULL; shaper->base_direction = FRIBIDI_PAR_ON; - if (!check_allocations(shaper, prealloc)) - goto error; #ifdef CONFIG_HARFBUZZ if (!init_features(shaper)) diff --git a/libass/ass_shaper.h b/libass/ass_shaper.h index f6404fe..5001fc7 100644 --- a/libass/ass_shaper.h +++ b/libass/ass_shaper.h @@ -25,7 +25,7 @@ typedef struct ass_shaper ASS_Shaper; #include "ass_render.h" void ass_shaper_info(ASS_Library *lib); -ASS_Shaper *ass_shaper_new(size_t prealloc); +ASS_Shaper *ass_shaper_new(void); void ass_shaper_free(ASS_Shaper *shaper); void ass_shaper_empty_cache(ASS_Shaper *shaper); void ass_shaper_set_kerning(ASS_Shaper *shaper, int kern); -- cgit v1.2.3