[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] grub-install: locale depends on nls
From: |
Daniel Kiper |
Subject: |
Re: [PATCH v2] grub-install: locale depends on nls |
Date: |
Wed, 7 Mar 2018 22:30:53 +0100 |
User-agent: |
Mutt/1.3.28i |
On Tue, Mar 06, 2018 at 09:05:26AM +0100, Olaf Hering wrote:
> With --disable-nls no locales exist.
>
> Avoid runtime error by moving code that copies locales into its own
> function. Return early in case nls was disabled. That way the compiler
> will throw away unreachable code, no need to put preprocessor
> conditionals everywhere to avoid warnings about unused code.
>
> Fix memleak by freeing dstf.
> Convert tabs to spaces in moved code.
>
> Signed-off-by: Olaf Hering <address@hidden>
> ---
> util/grub-install-common.c | 107
> ++++++++++++++++++++++++---------------------
> 1 file changed, 58 insertions(+), 49 deletions(-)
>
> diff --git a/util/grub-install-common.c b/util/grub-install-common.c
> index 9e3e358c9..56197fa1d 100644
> --- a/util/grub-install-common.c
> +++ b/util/grub-install-common.c
> @@ -725,13 +725,68 @@ grub_install_get_platform_platform (enum
> grub_install_plat platid)
> return platforms[platid].platform;
> }
>
> +static void
> +grub_install_copy_nls(const char *src, const char *dst)
> +{
> + char *dst_locale;
> +
> +#if !(defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS)
> + /* No locales exist without NLS. */
> + return;
> +#endif
Sorry, I do not like it. Please use "__attribute__ ((unused))" for the function
arguments and put #if/#endif around its whole body.
Daniel