diff options
author | André Goddard Rosa <andre.goddard@gmail.com> | 2010-01-30 22:46:25 -0200 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2010-05-17 09:34:13 -0700 |
commit | a910abcd194830d2d113b3e183eb7df4d36cd92e (patch) | |
tree | 291303f658796db61bcbf9b8107b3a88a4f83c79 /libc/stdio/fread.c | |
parent | 1297428e89ead45849068989d334d8b7eae2f602 (diff) | |
download | bionic-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/stdio/fread.c')
-rw-r--r-- | libc/stdio/fread.c | 66 |
1 files changed, 33 insertions, 33 deletions
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); } |