bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

small improvement to base64


From: Ralf Wildenhues
Subject: small improvement to base64
Date: Mon, 12 Sep 2005 19:06:09 +0200
User-agent: Mutt/1.4.1i

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.  :)

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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]