summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2010-01-30 22:46:25 -0200
committerJean-Baptiste Queru <jbq@google.com>2010-05-17 09:34:13 -0700
commita910abcd194830d2d113b3e183eb7df4d36cd92e (patch)
tree291303f658796db61bcbf9b8107b3a88a4f83c79 /libc
parent1297428e89ead45849068989d334d8b7eae2f602 (diff)
downloadbionic-a910abcd194830d2d113b3e183eb7df4d36cd92e.zip
bionic-a910abcd194830d2d113b3e183eb7df4d36cd92e.tar.gz
bionic-a910abcd194830d2d113b3e183eb7df4d36cd92e.tar.bz2
improve readability of stdio: fix indentation and remove trailing spaces
Change-Id: Ic51e58a7c75d20bf770dc0ebd7f97a338fbe0036 Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/fgets.c6
-rw-r--r--libc/stdio/findfp.c2
-rw-r--r--libc/stdio/fopen.c2
-rw-r--r--libc/stdio/fprintf.c4
-rw-r--r--libc/stdio/fread.c66
-rw-r--r--libc/stdio/freopen.c4
-rw-r--r--libc/stdio/fseek.c2
-rw-r--r--libc/stdio/fvwrite.c4
-rw-r--r--libc/stdio/printf.c4
-rw-r--r--libc/stdio/putchar.c2
-rw-r--r--libc/stdio/snprintf.c4
-rw-r--r--libc/stdio/sprintf.c4
-rw-r--r--libc/stdio/sscanf.c4
-rw-r--r--libc/stdio/stdio.c4
-rw-r--r--libc/stdio/vsscanf.c1
15 files changed, 56 insertions, 57 deletions
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index 99bdac9..f26385d 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -63,12 +63,12 @@ fgets(char *buf, int n, FILE *fp)
/* EOF/error: stop with partial or no line */
if (s == buf)
return (NULL);
- break;
- }
+ break;
+ }
}
len = fp->_r;
p = fp->_p;
-
+
/*
* Scan through at most n bytes of the current buffer,
* looking for '\n'. If found, copy up to and including
diff --git a/libc/stdio/findfp.c b/libc/stdio/findfp.c
index a55a65d..039293f 100644
--- a/libc/stdio/findfp.c
+++ b/libc/stdio/findfp.c
@@ -50,7 +50,7 @@ int __sdidinit;
/* p r w flags file _bf z cookie close read seek write
ext */
- /* the usual - (stdin + stdout + stderr) */
+/* the usual - (stdin + stdout + stderr) */
static FILE usual[FOPEN_MAX - 3];
static struct __sfileext usualext[FOPEN_MAX - 3];
static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c
index de15dc3..a6cddd3 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -53,7 +53,7 @@ fopen(const char *file, const char *mode)
if ((f = open(file, oflags, DEFFILEMODE)) < 0) {
fp->_flags = 0; /* release */
return (NULL);
- }
+ }
fp->_file = f;
fp->_flags = flags;
fp->_cookie = fp;
diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c
index 809d8db..7415b2f 100644
--- a/libc/stdio/fprintf.c
+++ b/libc/stdio/fprintf.c
@@ -38,10 +38,10 @@ int
fprintf(FILE *fp, const char *fmt, ...)
{
int ret;
- va_list ap;
+ va_list ap;
va_start(ap, fmt);
ret = vfprintf(fp, fmt, ap);
- va_end(ap);
+ va_end(ap);
return (ret);
}
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index 9f9977f..69c40b3 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -48,29 +48,29 @@ lflush(FILE *fp)
size_t
fread(void *buf, size_t size, size_t count, FILE *fp)
{
- size_t resid;
- char *p;
- int r;
- size_t total;
+ size_t resid;
+ char *p;
+ int r;
+ size_t total;
- /*
- * The ANSI standard requires a return value of 0 for a count
- * or a size of 0. Peculiarily, it imposes no such requirements
- * on fwrite; it only requires fread to be broken.
- */
- if ((resid = count * size) == 0)
- return (0);
- if (fp->_r < 0)
- fp->_r = 0;
- total = resid;
- p = buf;
+ /*
+ * The ANSI standard requires a return value of 0 for a count
+ * or a size of 0. Peculiarily, it imposes no such requirements
+ * on fwrite; it only requires fread to be broken.
+ */
+ if ((resid = count * size) == 0)
+ return (0);
+ if (fp->_r < 0)
+ fp->_r = 0;
+ total = resid;
+ p = buf;
#if 1 /* BIONIC: optimize unbuffered reads */
if (fp->_flags & __SNBF && fp->_ur == 0)
{
- /* the following comes mainly from __srefill(), with slight
- * modifications
- */
+ /* the following comes mainly from __srefill(), with slight
+ * modifications
+ */
/* make sure stdio is set up */
if (!__sdidinit)
@@ -99,22 +99,22 @@ fread(void *buf, size_t size, size_t count, FILE *fp)
}
fp->_flags |= __SRD;
} else {
- /*
- * We were reading. If there is an ungetc buffer,
- * we must have been reading from that. Drop it,
- * restoring the previous buffer (if any). If there
- * is anything in that buffer, return.
- */
+ /*
+ * We were reading. If there is an ungetc buffer,
+ * we must have been reading from that. Drop it,
+ * restoring the previous buffer (if any). If there
+ * is anything in that buffer, return.
+ */
if (HASUB(fp)) {
FREEUB(fp);
}
}
- /*
- * Before reading from a line buffered or unbuffered file,
- * flush all line buffered output files, per the ANSI C
- * standard.
- */
+ /*
+ * Before reading from a line buffered or unbuffered file,
+ * flush all line buffered output files, per the ANSI C
+ * standard.
+ */
if (fp->_flags & (__SLBF|__SNBF))
(void) _fwalk(lflush);
@@ -151,8 +151,8 @@ fread(void *buf, size_t size, size_t count, FILE *fp)
}
}
- (void)memcpy((void *)p, (void *)fp->_p, resid);
- fp->_r -= resid;
- fp->_p += resid;
- return (count);
+ (void)memcpy((void *)p, (void *)fp->_p, resid);
+ fp->_r -= resid;
+ fp->_p += resid;
+ return (count);
}
diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c
index 414d810..59b2228 100644
--- a/libc/stdio/freopen.c
+++ b/libc/stdio/freopen.c
@@ -40,8 +40,8 @@
#include <stdlib.h>
#include "local.h"
-/*
- * Re-direct an existing, open (probably) file to some other file.
+/*
+ * Re-direct an existing, open (probably) file to some other file.
* ANSI is written such that the original file gets closed if at
* all possible, no matter what.
*/
diff --git a/libc/stdio/fseek.c b/libc/stdio/fseek.c
index 0ac25e2..8581b62 100644
--- a/libc/stdio/fseek.c
+++ b/libc/stdio/fseek.c
@@ -204,7 +204,7 @@ fseeko(FILE *fp, off_t offset, int whence)
if ((*seekfn)(fp->_cookie, curoff, SEEK_SET) == POS_ERR)
goto dumb;
fp->_r = 0;
- fp->_p = fp->_bf._base;
+ fp->_p = fp->_bf._base;
if (HASUB(fp))
FREEUB(fp);
fp->_flags &= ~__SEOF;
diff --git a/libc/stdio/fvwrite.c b/libc/stdio/fvwrite.c
index bbea672..ee39400 100644
--- a/libc/stdio/fvwrite.c
+++ b/libc/stdio/fvwrite.c
@@ -83,7 +83,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
do {
GETIOV(;);
#if 1 /* BIONIC: don't limit to 1KB writes */
- w = (*fp->_write)(fp->_cookie, p, len);
+ w = (*fp->_write)(fp->_cookie, p, len);
#else
w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ2));
#endif
@@ -183,7 +183,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
} else if (s >= (w = fp->_bf._size)) {
w = (*fp->_write)(fp->_cookie, p, w);
if (w <= 0)
- goto err;
+ goto err;
} else {
w = s;
COPY(w);
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 4acc19b..614b435 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -38,10 +38,10 @@ int
printf(const char *fmt, ...)
{
int ret;
- va_list ap;
+ va_list ap;
va_start(ap, fmt);
ret = vfprintf(stdout, fmt, ap);
- va_end(ap);
+ va_end(ap);
return (ret);
}
diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c
index 233cdfd..eeed0a2 100644
--- a/libc/stdio/putchar.c
+++ b/libc/stdio/putchar.c
@@ -42,7 +42,7 @@ putchar_unlocked(int c)
{
FILE *so = stdout;
- return (putc_unlocked(c,so));
+ return (putc_unlocked(c, so));
}
#undef putchar
diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c
index e830c0f..45ef7eb 100644
--- a/libc/stdio/snprintf.c
+++ b/libc/stdio/snprintf.c
@@ -40,7 +40,7 @@
int
snprintf(char *str, size_t n, const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
int ret;
char dummy;
FILE f;
@@ -61,7 +61,7 @@ snprintf(char *str, size_t n, const char *fmt, ...)
f._bf._size = f._w = n - 1;
va_start(ap, fmt);
ret = vfprintf(&f, fmt, ap);
- va_end(ap);
+ va_end(ap);
*f._p = '\0';
return (ret);
}
diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c
index 739cde7..67f924b 100644
--- a/libc/stdio/sprintf.c
+++ b/libc/stdio/sprintf.c
@@ -46,7 +46,7 @@ int
sprintf(char *str, const char *fmt, ...)
{
int ret;
- va_list ap;
+ va_list ap;
FILE f;
struct __sfileext fext;
@@ -57,7 +57,7 @@ sprintf(char *str, const char *fmt, ...)
f._bf._size = f._w = INT_MAX;
va_start(ap, fmt);
ret = vfprintf(&f, fmt, ap);
- va_end(ap);
+ va_end(ap);
*f._p = '\0';
return (ret);
}
diff --git a/libc/stdio/sscanf.c b/libc/stdio/sscanf.c
index e141eec..a0bdf1c 100644
--- a/libc/stdio/sscanf.c
+++ b/libc/stdio/sscanf.c
@@ -48,7 +48,7 @@ int
sscanf(const char *str, const char *fmt, ...)
{
int ret;
- va_list ap;
+ va_list ap;
FILE f;
struct __sfileext fext;
@@ -60,6 +60,6 @@ sscanf(const char *str, const char *fmt, ...)
f._lb._base = NULL;
va_start(ap, fmt);
ret = vfscanf(&f, fmt, ap);
- va_end(ap);
+ va_end(ap);
return (ret);
}
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index a4a27b5..1596ebf 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -45,7 +45,7 @@ __sread(void *cookie, char *buf, int n)
{
FILE *fp = cookie;
int ret;
-
+
ret = read(fp->_file, buf, n);
/* if the read succeeded, update the current offset */
if (ret >= 0)
@@ -71,7 +71,7 @@ __sseek(void *cookie, fpos_t offset, int whence)
{
FILE *fp = cookie;
off_t ret;
-
+
ret = lseek(fp->_file, (off_t)offset, whence);
if (ret == (off_t)-1)
fp->_flags &= ~__SOFF;
diff --git a/libc/stdio/vsscanf.c b/libc/stdio/vsscanf.c
index 47c1ae6..9c4d805 100644
--- a/libc/stdio/vsscanf.c
+++ b/libc/stdio/vsscanf.c
@@ -39,7 +39,6 @@
static int
eofread(void *cookie, char *buf, int len)
{
-
return (0);
}