[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: small improvement to base64
From: |
Simon Josefsson |
Subject: |
Re: small improvement to base64 |
Date: |
Tue, 13 Sep 2005 10:05:24 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> Hi Simon,
>
> Please apply the tiny patch below to the base64 module to fix a typo and
> to put the long constant string in the initialized data section. This
> avoids reinitialization of the string upon function invocation and
> should thus generally be about a wee bit faster. :)
Thank you for a perfect bug report, Ralf. The patch has been
installed.
Regards,
Simon
> Cheers,
> Ralf
>
> 2005-09-12 Ralf Wildenhues <address@hidden> (tiny change)
>
> * lib/base64.c: Typo.
> (base64_encode): Put b64str in initialized data section.
>
> Index: lib/base64.c
> ===================================================================
> RCS file: /cvsroot/gnulib/gnulib/lib/base64.c,v
> retrieving revision 1.4
> diff -u -r1.4 base64.c
> --- lib/base64.c 27 Jun 2005 22:05:57 -0000 1.4
> +++ lib/base64.c 12 Sep 2005 17:04:09 -0000
> @@ -36,7 +36,7 @@
> * FAIL: input too long
> * if (out == NULL)
> * FAIL: memory allocation error
> - * OK: data in OUT/LEN.
> + * OK: data in OUT/OUTLEN.
> *
> */
>
> @@ -65,7 +65,7 @@
> base64_encode (const char *restrict in, size_t inlen,
> char *restrict out, size_t outlen)
> {
> - const char b64str[64] =
> + static const char b64str[64] =
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
>
> while (inlen && outlen)