improve readability of stdlib: fix indentation and remove trailing spaces

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>

Change-Id: I7dd90a0816b5376ffc1de4499d56935e0bd574a1
This commit is contained in:
André Goddard Rosa 2010-02-05 18:32:52 -02:00 committed by Jean-Baptiste Queru
parent 1698d9ebfc
commit e734769276
11 changed files with 230 additions and 232 deletions

View File

@ -49,6 +49,6 @@ __assert2(const char *file, int line, const char *func, const char *failedexpr)
(void)fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d, function \"%s\"\n",
failedexpr, file, line, func);
abort();
abort();
/* NOTREACHED */
}

View File

@ -53,7 +53,7 @@ const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
/* determine printability based on the IS0 8859 8-bit standard */
/* determine printability based on the IS0 8859 8-bit standard */
_L, _L, _L, _P, _P, _P, _P, _C,
_C, _C, _C, _C, _C, _C, _C, _C, /* 80 */

View File

@ -62,8 +62,8 @@ __findenv(const char *name, int *offset)
if (i == 0 && *cp++ == '=') {
*offset = p - environ;
return (cp);
}
}
}
}
return (NULL);
}

View File

@ -42,7 +42,7 @@ putenv(const char *str)
if ((equal = strchr(p, '=')) == NULL) {
(void)free(p);
return (-1);
}
}
*equal = '\0';
rval = setenv(p, equal + 1, 1);
(void)free(p);

View File

@ -39,11 +39,11 @@ static __inline void swapfunc(char *, char *, int, int);
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
*/
#define swapcode(TYPE, parmi, parmj, n) { \
long i = (n) / sizeof (TYPE); \
TYPE *pi = (TYPE *) (parmi); \
TYPE *pj = (TYPE *) (parmj); \
do { \
#define swapcode(TYPE, parmi, parmj, n) { \
long i = (n) / sizeof (TYPE); \
TYPE *pi = (TYPE *) (parmi); \
TYPE *pj = (TYPE *) (parmj); \
do { \
TYPE t = *pi; \
*pi++ = *pj; \
*pj++ = t; \
@ -56,7 +56,7 @@ static __inline void swapfunc(char *, char *, int, int);
static __inline void
swapfunc(char *a, char *b, int n, int swaptype)
{
if (swaptype <= 1)
if (swaptype <= 1)
swapcode(long, a, b, n)
else
swapcode(char, a, b, n)
@ -70,7 +70,7 @@ swapfunc(char *a, char *b, int n, int swaptype)
} else \
swapfunc(a, b, es, swaptype)
#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
static __inline char *
med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
@ -110,7 +110,7 @@ loop: SWAPINIT(a, es);
}
swap(a, pm);
pa = pb = (char *)a + es;
pc = pd = (char *)a + (n - 1) * es;
for (;;) {
while (pb <= pc && (r = cmp(pb, a)) <= 0) {
@ -118,7 +118,7 @@ loop: SWAPINIT(a, es);
swap_cnt = 1;
swap(pa, pb);
pa += es;
}
}
pb += es;
}
while (pb <= pc && (r = cmp(pc, a)) >= 0) {
@ -138,11 +138,11 @@ loop: SWAPINIT(a, es);
}
if (swap_cnt == 0) { /* Switch to insertion sort */
for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es)
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0;
pl -= es)
swap(pl, pl - es);
return;
}
}
pn = (char *)a + n * es;
r = min(pa - (char *)a, pb - pa);
@ -151,11 +151,11 @@ loop: SWAPINIT(a, es);
vecswap(pb, pn - r, r);
if ((r = pb - pa) > (int)es)
qsort(a, r / es, es, cmp);
if ((r = pd - pc) > (int)es) {
if ((r = pd - pc) > (int)es) {
/* Iterate rather than recurse to save stack space */
a = pn - r;
n = r / es;
goto loop;
}
/* qsort(pn - r, r / es, es, cmp);*/
/* qsort(pn - r, r / es, es, cmp); */
}

View File

@ -22,7 +22,7 @@ unsigned short *
seed48(unsigned short xseed[3])
{
static unsigned short sseed[3];
sseed[0] = __rand48_seed[0];
sseed[1] = __rand48_seed[1];
sseed[2] = __rand48_seed[2];

View File

@ -4,7 +4,7 @@ By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
-----------------
Modified 7/98
Modified 7/98
By James H. Brown <jbrown@burgoyne.com>
Still 100% Public Domain
@ -26,7 +26,7 @@ Since the file IO in main() reads 16K at a time, any file 8K or larger would
be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
"a"s).
I also changed the declaration of variables i & j in SHA1Update to
I also changed the declaration of variables i & j in SHA1Update to
unsigned long from unsigned int for the same reason.
These changes should make no difference to any 32 bit implementations since
@ -53,7 +53,7 @@ Still 100% public domain
Modified 4/01
By Saul Kravitz <Saul.Kravitz@celera.com>
Still 100% PD
Modified to run on Compaq Alpha hardware.
Modified to run on Compaq Alpha hardware.
-----------------
Modified 2/03
@ -116,7 +116,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
void SHAPrintContext(SHA1_CTX *context, char *msg){
printf("%s (%d,%d) %x %x %x %x %x\n",
msg,
context->count[0], context->count[1],
context->count[0], context->count[1],
context->state[0],
context->state[1],
context->state[2],
@ -238,8 +238,7 @@ unsigned char finalcount[8];
while ((context->count[0] & 504) != 448) {
SHA1Update(context, (unsigned char *)"\0", 1);
}
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
*/
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
for (i = 0; i < 20; i++) {
digest[i] = (unsigned char)
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
@ -254,7 +253,7 @@ unsigned char finalcount[8];
SHA1Transform(context->state, context->buffer);
#endif
}
/*************************************************************/
/* This is not quite the MIME base64 algorithm: it uses _ instead of /,
@ -302,7 +301,7 @@ int main(int argc, char** argv)
fputs("Unable to open file.", stderr);
return(-1);
}
}
}
SHA1Init(&context);
while (!feof(file)) { /* note: what if ferror(file) */
i = fread(buffer, 1, 16384, file);

File diff suppressed because it is too large Load Diff

View File

@ -103,7 +103,7 @@ strtoimax(const char *nptr, char **endptr, int base)
cutoff = INTMAX_MAX / x; \
}; \
break
switch (base) {
case 4:
if (neg) {
@ -118,13 +118,13 @@ strtoimax(const char *nptr, char **endptr, int base)
CASE_BASE(8);
CASE_BASE(10);
CASE_BASE(16);
default:
default:
cutoff = neg ? INTMAX_MIN : INTMAX_MAX;
cutlim = cutoff % base;
cutoff /= base;
}
#undef CASE_BASE
if (neg) {
if (cutlim > 0) {
cutlim -= base;

View File

@ -57,7 +57,7 @@ strtoumax(const char *nptr, char **endptr, int base)
if (c == '-') {
neg = 1;
c = *s++;
} else {
} else {
neg = 0;
if (c == '+')
c = *s++;
@ -76,7 +76,7 @@ strtoumax(const char *nptr, char **endptr, int base)
case x: cutoff = UINTMAX_MAX / x; \
cutlim = UINTMAX_MAX % x; \
break
switch (base) {
CASE_BASE(8);
CASE_BASE(10);
@ -85,7 +85,7 @@ strtoumax(const char *nptr, char **endptr, int base)
cutoff = UINTMAX_MAX / base;
cutlim = UINTMAX_MAX % base;
}
for (acc = 0, any = 0;; c = (unsigned char) *s++) {
if (isdigit(c))
c -= '0';

View File

@ -387,7 +387,7 @@ size_t wcsxfrm(wchar_t *ws1, const wchar_t *ws2, size_t n)
int wctob(wint_t c)
{
return c;
return c;
}
wctype_t wctype(const char *property)