public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive
@ 2023-04-26 12:10 Frédéric Bérat
  2023-04-26 12:12 ` Siddhesh Poyarekar
  2023-04-26 12:23 ` [PATCH v2] " Frédéric Bérat
  0 siblings, 2 replies; 5+ messages in thread
From: Frédéric Bérat @ 2023-04-26 12:10 UTC (permalink / raw)
  To: libc-alpha; +Cc: siddhesh

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(-)

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);
-- 
2.39.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive
  2023-04-26 12:10 [PATCH] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive Frédéric Bérat
@ 2023-04-26 12:12 ` Siddhesh Poyarekar
  2023-04-26 12:17   ` Siddhesh Poyarekar
  2023-04-26 12:23 ` [PATCH v2] " Frédéric Bérat
  1 sibling, 1 reply; 5+ messages in thread
From: Siddhesh Poyarekar @ 2023-04-26 12:12 UTC (permalink / raw)
  To: Frédéric Bérat, libc-alpha

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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive
  2023-04-26 12:12 ` Siddhesh Poyarekar
@ 2023-04-26 12:17   ` Siddhesh Poyarekar
  0 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2023-04-26 12:17 UTC (permalink / raw)
  To: Frédéric Bérat, libc-alpha

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);
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive
  2023-04-26 12:10 [PATCH] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive Frédéric Bérat
  2023-04-26 12:12 ` Siddhesh Poyarekar
@ 2023-04-26 12:23 ` Frédéric Bérat
  2023-04-26 12:29   ` Siddhesh Poyarekar
  1 sibling, 1 reply; 5+ messages in thread
From: Frédéric Bérat @ 2023-04-26 12:23 UTC (permalink / raw)
  To: libc-alpha; +Cc: siddhesh

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(-)

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.  */
-- 
2.40.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive
  2023-04-26 12:23 ` [PATCH v2] " Frédéric Bérat
@ 2023-04-26 12:29   ` Siddhesh Poyarekar
  0 siblings, 0 replies; 5+ messages in thread
From: Siddhesh Poyarekar @ 2023-04-26 12:29 UTC (permalink / raw)
  To: Frédéric Bérat, libc-alpha

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.  */

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-26 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 12:10 [PATCH] locale/programs/locarchive.c: Remove unnecessary check in add_locale_archive Frédéric Bérat
2023-04-26 12:12 ` Siddhesh Poyarekar
2023-04-26 12:17   ` Siddhesh Poyarekar
2023-04-26 12:23 ` [PATCH v2] " Frédéric Bérat
2023-04-26 12:29   ` Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).