|
From: | Vladimir 'phcoder' Serbinenko |
Subject: | Re: [PATCH v5 16/16] fs/ntfs: Simplify to use grub_utf16_to_utf8_alloc() |
Date: | Wed, 23 Aug 2023 14:27:21 +0200 |
Hi Vladimir,
On Tue, 2023-08-22 at 23:48 +0200, Vladimir 'phcoder' Serbinenko wrote:
> Would it be easier to change all call sites to use
> utf16_to_utf8_alloc?
Please note that grub_utf16_to_utf8_alloc and grub_utf16_to_utf8 are
both inline. There are 3 invocations of get_utf8 function in ntfs
module. All 3 places would expand with grub_utf16_to_utf8_alloc and
grub_utf16_to_utf8 code, causing increase of .mod file size.
With Best Regards,
Vitaly.
>
> Le mar. 22 août 2023, 23:40, Vitaly Kuzmichev
> <vitaly.kuzmichev@rtsoft.de> a écrit :
> > Transform get_utf8() function to use grub_utf16_to_utf8_alloc()
> > helper function to convert strings from UTF-16 to UTF-8.
> >
> > Signed-off-by: Vitaly Kuzmichev <vitaly.kuzmichev@rtsoft.de>
> > ---
> > grub-core/fs/ntfs.c | 18 +-----------------
> > 1 file changed, 1 insertion(+), 17 deletions(-)
> >
> > diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c
> > index 1bee35e87..9258ea835 100644
> > --- a/grub-core/fs/ntfs.c
> > +++ b/grub-core/fs/ntfs.c
> > @@ -552,23 +552,7 @@ free_file (struct grub_ntfs_file *mft)
> > static char *
> > get_utf8 (grub_uint8_t *in, grub_size_t len)
> > {
> > - grub_uint8_t *buf;
> > - grub_uint16_t *tmp;
> > - grub_size_t i;
> > -
> > - buf = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1);
> > - tmp = grub_calloc (len, sizeof (tmp[0]));
> > - if (!buf || !tmp)
> > - {
> > - grub_free (buf);
> > - grub_free (tmp);
> > - return NULL;
> > - }
> > - for (i = 0; i < len; i++)
> > - tmp[i] = grub_le_to_cpu16 (grub_get_unaligned16 (in + 2 * i));
> > - *grub_utf16_to_utf8 (buf, tmp, len, UTF16_CPU) = '\0';
> > - grub_free (tmp);
> > - return (char *) buf;
> > + return (char *) grub_utf16_to_utf8_alloc (in, len, UTF16_LE);
> > }
> >
> > static int
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
[Prev in Thread] | Current Thread | [Next in Thread] |