| #include "starboard/common/log.h" |
| size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f) |
| if (!f->wend && __towrite(f)) return 0; |
| if (l > f->wend - f->wpos) return f->write(f, s, l); |
| for (i=l; i && s[i-1] != '\n'; i--); |
| size_t n = f->write(f, s, i); |
| size_t fwrite(const void *restrict src, size_t size, size_t nmemb, FILE *restrict f) |
| SB_DCHECK((f == stdout) || (f == stderr)); |
| SbLogRawFormatF("%.*s", size * nmemb, src); |
| size_t k, l = size*nmemb; |
| k = __fwritex(src, l, f); |
| return k==l ? nmemb : k/size; |
| weak_alias(fwrite, fwrite_unlocked); |