1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Remove redundant nested function b64_from_24bit

Move multiple definitions of the nested function b64_from_24bit into a
single function __b64_from_24bit.
This commit is contained in:
Konstantin Serebryany
2014-06-03 16:39:08 +05:30
committed by Siddhesh Poyarekar
parent d936d379eb
commit 8747cd034a
6 changed files with 121 additions and 95 deletions

View File

@ -253,6 +253,10 @@ static ufc_long eperm32tab[4][256][2];
*/
static ufc_long efp[16][64][2];
/* Table with characters for base64 transformation. */
static const char b64t[64] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
/*
* For use by the old, non-reentrant routines
* (crypt/encrypt/setkey)
@ -956,3 +960,17 @@ setkey(__key)
{
__setkey_r(__key, &_ufc_foobar);
}
void
__b64_from_24bit (char **cp, int *buflen,
unsigned int b2, unsigned int b1, unsigned int b0,
int n)
{
unsigned int w = (b2 << 16) | (b1 << 8) | b0;
while (n-- > 0 && (*buflen) > 0)
{
*(*cp)++ = b64t[w & 0x3f];
--(*buflen);
w >>= 6;
}
}