Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 46ac986 in mainline


Ignore:
Timestamp:
2011-07-11T21:57:54Z (10 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master
Children:
221afc9e
Parents:
12fb8498
Message:

Coding style improvements in stdio (no changes in functionality).

Location:
uspace/lib/posix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/stdio.c

    r12fb8498 r46ac986  
    100100
    101101        bool can_unget =
    102                 /* Provided character is legal. */
     102            /* Provided character is legal. */
    103103            c != EOF &&
    104                 /* Stream is consistent. */
     104            /* Stream is consistent. */
    105105            !stream->error &&
    106                 /* Stream is buffered. */
     106            /* Stream is buffered. */
    107107            stream->btype != _IONBF &&
    108                 /* Last operation on the stream was a read operation. */
     108            /* Last operation on the stream was a read operation. */
    109109            stream->buf_state == _bs_read &&
    110                 /* Stream buffer is already allocated (i.e. there was already carried
    111                 * out either write or read operation on the stream). This is probably
    112                 * redundant check but let's be safe. */
     110            /* Stream buffer is already allocated (i.e. there was already carried
     111            * out either write or read operation on the stream). This is probably
     112            * redundant check but let's be safe. */
    113113            stream->buf != NULL &&
    114                 /* There is still space in the stream to retreat. POSIX demands the
    115                 * possibility to unget at least 1 character. It should be always
    116                 * possible, assuming the last operation on the stream read at least 1
    117                 * character, because the buffer is refilled in the lazily manner. */
     114            /* There is still space in the stream to retreat. POSIX demands the
     115            * possibility to unget at least 1 character. It should be always
     116            * possible, assuming the last operation on the stream read at least 1
     117            * character, because the buffer is refilled in the lazily manner. */
    118118            stream->buf_tail > stream->buf;
    119119
     
    230230 *     stream with a changed mode. NULL otherwise.
    231231 */
    232 FILE *posix_freopen(
    233     const char *restrict filename,
    234     const char *restrict mode,
    235     FILE *restrict stream)
     232FILE *posix_freopen(const char *restrict filename,
     233    const char *restrict mode, FILE *restrict stream)
    236234{
    237235        assert(mode != NULL);
  • uspace/lib/posix/stdio.h

    r12fb8498 r46ac986  
    4242#include "limits.h"
    4343
     44/* Identifying the Terminal */
    4445#undef L_ctermid
    4546#define L_ctermid PATH_MAX
     47extern char *posix_ctermid(char *s);
    4648
     49/* Error Recovery */
    4750extern void posix_clearerr(FILE *stream);
    48 extern char *posix_ctermid(char *s);
    4951
    5052/* Input/Output */
     
    5456#define getc fgetc
    5557extern int posix_ungetc(int c, FILE *stream);
    56 
    5758extern ssize_t posix_getdelim(char **restrict lineptr, size_t *restrict n,
    5859    int delimiter, FILE *restrict stream);
     
    6162
    6263/* Opening Streams */
    63 extern FILE *posix_freopen(
    64    const char *restrict filename,
    65    const char *restrict mode,
    66    FILE *restrict stream);
    67 
    68 /* Memory Streams */
    69 
     64extern FILE *posix_freopen(const char *restrict filename,
     65    const char *restrict mode, FILE *restrict stream);
    7066extern FILE *posix_fmemopen(void *restrict buf, size_t size,
    7167    const char *restrict mode);
     
    7672
    7773/* File Positioning */
    78 
    7974typedef struct _posix_fpos posix_fpos_t;
    8075extern int posix_fsetpos(FILE *stream, const posix_fpos_t *pos);
     
    8580extern posix_off_t posix_ftello(FILE *stream);
    8681
    87 /* Formatted Input/Output */
     82/* Formatted Output */
    8883extern int posix_dprintf(int fildes, const char *restrict format, ...)
    8984    PRINTF_ATTRIBUTE(2, 3);
     
    9388extern int posix_vsprintf(char *restrict s, const char *restrict format, va_list ap);
    9489
     90/* Formatted Input */
    9591extern int posix_fscanf(
    9692    FILE *restrict stream, const char *restrict format, ...);
     
    105101
    106102/* File Locking */
    107 
    108103extern void posix_flockfile(FILE *file);
    109104extern int posix_ftrylockfile(FILE *file);
    110105extern void posix_funlockfile(FILE *file);
    111 
    112106extern int posix_getc_unlocked(FILE *stream);
    113107extern int posix_getchar_unlocked(void);
     
    121115#undef L_tmpnam
    122116#define L_tmpnam PATH_MAX
    123 
    124117extern char *posix_tmpnam(char *s);
    125118
    126119#ifndef LIBPOSIX_INTERNAL
    127         #define clearerr posix_clearerr
    128120        #define ctermid posix_ctermid
    129121
     122        #define clearerr posix_clearerr
     123
    130124        #define ungetc posix_ungetc
    131 
    132125        #define getdelim posix_getdelim
    133126        #define getline posix_getline
    134127
    135128        #define freopen posix_freopen
    136 
    137129        #define fmemopen posix_fmemopen
    138130        #define open_memstream posix_open_memstream
Note: See TracChangeset for help on using the changeset viewer.