diff mbox series

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

Message ID 20230426121033.921725-1-fberat@redhat.com
State New
Headers show
Series locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive | expand

Commit Message

Frederic Berat April 26, 2023, 12:10 p.m. UTC
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:12 p.m. UTC | #1
On 2023-04-26 08:10, Frédéric Bérat wrote:
> 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 f8c6f79afa..71fd9f34fa 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.  */
>       if (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 ?: "") < 0)
>         {
>   	free ((char *) normalized_codeset);
Siddhesh Poyarekar April 26, 2023, 12:17 p.m. UTC | #2
On 2023-04-26 08:12, Siddhesh Poyarekar wrote:
> On 2023-04-26 08:10, Frédéric Bérat wrote:
>> 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>

Sorry, it doesn't apply, like you mentioned to me off-list.  Please send 
a v2.

Thanks,
Sid

>>   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 f8c6f79afa..71fd9f34fa 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.  */
>>       if (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 ?: "") < 0)
>>         {
>>       free ((char *) normalized_codeset);
>
diff mbox series

Patch

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index f8c6f79afa..71fd9f34fa 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.  */
     if (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 ?: "") < 0)
       {
 	free ((char *) normalized_codeset);