26,12 → 26,12 |
|
ANSI_SYNOPSIS |
#include <stdio.h> |
size_t fwrite(const void *<[buf]>, size_t <[size]>, |
size_t <[count]>, FILE *<[fp]>); |
size_t fwrite(const void *restrict <[buf]>, size_t <[size]>, |
size_t <[count]>, FILE *restrict <[fp]>); |
|
#include <stdio.h> |
size_t _fwrite_r(struct _reent *<[ptr]>, const void *<[buf]>, size_t <[size]>, |
size_t <[count]>, FILE *<[fp]>); |
size_t _fwrite_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>, |
size_t <[count]>, FILE *restrict <[fp]>); |
|
TRAD_SYNOPSIS |
#include <stdio.h> |
97,12 → 97,13 |
size_t |
_DEFUN(_fwrite_r, (ptr, buf, size, count, fp), |
struct _reent * ptr _AND |
_CONST _PTR buf _AND |
_CONST _PTR __restrict buf _AND |
size_t size _AND |
size_t count _AND |
FILE * fp) |
FILE * __restrict fp) |
{ |
size_t n; |
#ifdef _FVWRITE_IN_STREAMIO |
struct __suio uio; |
struct __siov iov; |
|
119,21 → 120,45 |
|
CHECK_INIT(ptr, fp); |
|
_flockfile (fp); |
_newlib_flockfile_start (fp); |
ORIENT (fp, -1); |
if (__sfvwrite_r (ptr, fp, &uio) == 0) |
{ |
_funlockfile (fp); |
_newlib_flockfile_exit (fp); |
return count; |
} |
_funlockfile (fp); |
_newlib_flockfile_end (fp); |
return (n - uio.uio_resid) / size; |
#else |
size_t i = 0; |
_CONST char *p = buf; |
n = count * size; |
CHECK_INIT (ptr, fp); |
|
_newlib_flockfile_start (fp); |
ORIENT (fp, -1); |
/* Make sure we can write. */ |
if (cantwrite (ptr, fp)) |
goto ret; |
|
while (i < n) |
{ |
if (__sputc_r (ptr, p[i], fp) == EOF) |
break; |
|
i++; |
} |
|
ret: |
_newlib_flockfile_end (fp); |
return i / size; |
#endif |
} |
|
#ifndef _REENT_ONLY |
size_t |
_DEFUN(fwrite, (buf, size, count, fp), |
_CONST _PTR buf _AND |
_CONST _PTR __restrict buf _AND |
size_t size _AND |
size_t count _AND |
FILE * fp) |