Hi Vladimir,
On Tue, 2023-08-22 at 23:49 +0200, Vladimir 'phcoder' Serbinenko wrote:
> Maybe change all call sites and eliminate this function altogether?
Same problem here as in ntfs module. We have 2 invocations of
grub_iso9660_convert_string in the module, so this would increase
module size by double the size of grub_utf16_to_utf8_alloc and
grub_utf16_to_utf8 functions.
BTW did you check this claim? AFAIR inline unlike always_inline will still create a function and call it if there are several call sites and function is large
>
> Le mar. 22 août 2023, 23:41, Vitaly Kuzmichev
> <vitaly.kuzmichev@rtsoft.de> a écrit :
> > Transform grub_iso9660_convert_string() function to use
> > grub_utf16_to_utf8_alloc() helper function to convert file names
> > and
> > volume name from UTF-16 to UTF-8.
> >
> > Signed-off-by: Vitaly Kuzmichev <vitaly.kuzmichev@rtsoft.de>
> > ---
> > grub-core/fs/iso9660.c | 15 +--------------
> > 1 file changed, 1 insertion(+), 14 deletions(-)
> >
> > diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c
> > index 5eb6c1a0a..d2ea397ee 100644
> > --- a/grub-core/fs/iso9660.c
> > +++ b/grub-core/fs/iso9660.c
> > @@ -376,20 +376,7 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t
> > node, grub_off_t off,
> > static char *
> > grub_iso9660_convert_string (grub_uint8_t *us, int len)
> > {
> > - char *p;
> > - int i;
> > - grub_uint16_t t[MAX_NAMELEN / 2 + 1];
> > -
> > - p = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1);
> > - if (! p)
> > - return NULL;
> > -
> > - for (i=0; i<len; i++)
> > - t[i] = grub_be_to_cpu16 (grub_get_unaligned16 (us + 2 * i));
> > -
> > - *grub_utf16_to_utf8 ((grub_uint8_t *) p, t, len, UTF16_CPU) =
> > '\0';
> > -
> > - return p;
> > + return (char *) grub_utf16_to_utf8_alloc (us, len, UTF16_BE);
> > }
> >
> > static grub_err_t
> > _______________________________________________
> > 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