[v2] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive

Message ID 20230426122349.922467-1-fberat@redhat.com
State Committed
Commit a9f806d4532de2c9124c6caaae88b53ea56cdddd
Headers
Series [v2] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Frederic Berat April 26, 2023, 12:23 p.m. UTC
  Changes since v1:
- Rebased on master

--8<--

Since asprintf is called "if (mask & XPG_NORM_CODESET)" there is no
point in checking the mask again within the asprintf call.
---
 locale/programs/locarchive.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Siddhesh Poyarekar April 26, 2023, 12:29 p.m. UTC | #1
On 2023-04-26 08:23, Frédéric Bérat wrote:
> Changes since v1:
> - Rebased on master
> 
> --8<--
> 
> Since asprintf is called "if (mask & XPG_NORM_CODESET)" there is no
> point in checking the mask again within the asprintf call.
> ---

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>


>   locale/programs/locarchive.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
> index 87d2d9b1b2..8d7d51af6c 100644
> --- a/locale/programs/locarchive.c
> +++ b/locale/programs/locarchive.c
> @@ -1156,7 +1156,7 @@ add_locale_to_archive (struct locarhandle *ah, const char *name,
>          We will store it in the archive with a normalized name.  */
>       asprintf (&normalized_name, "%s%s%s.%s%s%s",
>   	      language, territory == NULL ? "" : "_", territory ?: "",
> -	      (mask & XPG_NORM_CODESET) ? normalized_codeset : codeset,
> +	      normalized_codeset,
>   	      modifier == NULL ? "" : "@", modifier ?: "");
>   
>     /* This call does the main work.  */
  

Patch

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 87d2d9b1b2..8d7d51af6c 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1156,7 +1156,7 @@  add_locale_to_archive (struct locarhandle *ah, const char *name,
        We will store it in the archive with a normalized name.  */
     asprintf (&normalized_name, "%s%s%s.%s%s%s",
 	      language, territory == NULL ? "" : "_", territory ?: "",
-	      (mask & XPG_NORM_CODESET) ? normalized_codeset : codeset,
+	      normalized_codeset,
 	      modifier == NULL ? "" : "@", modifier ?: "");
 
   /* This call does the main work.  */