Patchwork vfprintf: Reduce WORK_BUFFER_SIZE for wchar_t builds

login
register
mail settings
Submitter Florian Weimer
Date June 19, 2017, 4:19 p.m.
Message ID <20170619161930.5E4C6402AEC0E@oldenburg.str.redhat.com>
Download mbox | patch
Permalink /patch/21102/
State Committed
Headers show

Comments

Florian Weimer - June 19, 2017, 4:19 p.m.
2017-06-19  Florian Weimer  <fweimer@redhat.com>

	* stdio-common/vfprintf.c (WORK_BUFFER_SIZE): Reduce size for
	wchar_t builds.
Adhemerval Zanella Netto - June 27, 2017, 6:01 p.m.
On 19/06/2017 13:19, Florian Weimer wrote:
> 2017-06-19  Florian Weimer  <fweimer@redhat.com>
> 
> 	* stdio-common/vfprintf.c (WORK_BUFFER_SIZE): Reduce size for
> 	wchar_t builds.

LGTM, thanks.

> 
> diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
> index c43326c..76614fc 100644
> --- a/stdio-common/vfprintf.c
> +++ b/stdio-common/vfprintf.c
> @@ -204,7 +204,7 @@ typedef wchar_t THOUSANDS_SEP_T;
>  static const CHAR_T null[] = L_("(null)");
>  
>  /* Size of the work_buffer variable (in characters, not bytes.  */
> -enum { WORK_BUFFER_SIZE = 1000 };
> +enum { WORK_BUFFER_SIZE = 1000 / sizeof (CHAR_T) };
>  
>  /* This table maps a character into a number representing a class.  In
>     each step there is a destination label for each class.  */
>

Patch

diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index c43326c..76614fc 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -204,7 +204,7 @@  typedef wchar_t THOUSANDS_SEP_T;
 static const CHAR_T null[] = L_("(null)");
 
 /* Size of the work_buffer variable (in characters, not bytes.  */
-enum { WORK_BUFFER_SIZE = 1000 };
+enum { WORK_BUFFER_SIZE = 1000 / sizeof (CHAR_T) };
 
 /* This table maps a character into a number representing a class.  In
    each step there is a destination label for each class.  */