From b25265fe553c3420148bfa42bed4e2832558df85 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 19 May 2024 22:58:23 -0400 Subject: [PATCH] [bdf] Use concise macros. * src/bdf/bdflib.c (bdf_create_property): Use FT_STRDUP. (bdf_parse_glyphs_, bdf_parse_start_): Use FT_DUP for brevity. --- src/bdf/bdflib.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 0fa7e0a8c..813a4d839 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -864,15 +864,9 @@ p = font->user_props + font->nuser_props; - n = ft_strlen( name ) + 1; - if ( n > FT_LONG_MAX ) - return FT_THROW( Invalid_Argument ); - - if ( FT_QALLOC( p->name, n ) ) + if ( FT_STRDUP( p->name, name ) ) goto Exit; - FT_MEM_COPY( (char *)p->name, name, n ); - p->format = format; p->builtin = 0; p->value.atom = NULL; /* nothing is ever stored here */ @@ -1442,11 +1436,9 @@ goto Exit; } - if ( FT_QALLOC( p->glyph_name, slen + 1 ) ) + if ( FT_DUP( p->glyph_name, s, slen + 1 ) ) goto Exit; - FT_MEM_COPY( p->glyph_name, s, slen + 1 ); - p->flags |= BDF_GLYPH_; FT_TRACE4(( DBGMSG1, lineno, s )); @@ -2051,9 +2043,8 @@ /* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */ FT_FREE( p->font->name ); - if ( FT_QALLOC( p->font->name, slen + 1 ) ) + if ( FT_DUP( p->font->name, s, slen + 1 ) ) goto Exit; - FT_MEM_COPY( p->font->name, s, slen + 1 ); /* If the font name is an XLFD name, set the spacing to the one in */ /* the font name. If there is no spacing fall back on the default. */