Changeset c7c6afd in mainline for uspace/lib/c/generic/io/vprintf.c
- Timestamp:
- 2025-04-13T23:27:44Z (4 weeks ago)
- Children:
- b6061f8c
- Parents:
- 240b2e4 (diff), f5e1692 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Wayne Thornton <wmthornton-dev@…> (2025-04-13 23:27:44)
- git-committer:
- GitHub <noreply@…> (2025-04-13 23:27:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/vprintf.c
r240b2e4 rc7c6afd 42 42 static FIBRIL_MUTEX_INITIALIZE(printf_mutex); 43 43 44 static int vprintf_str_write(const char *str, size_t size, void *stream)44 static errno_t vprintf_str_write(const char *str, size_t size, void *stream) 45 45 { 46 size_t wr = fwrite(str, 1, size, (FILE *) stream); 47 return str_nlength(str, wr); 48 } 46 errno_t old_errno = errno; 49 47 50 static int vprintf_wstr_write(const char32_t *str, size_t size, void *stream) 51 { 52 size_t offset = 0; 53 size_t chars = 0; 48 errno = EOK; 49 size_t written = fwrite(str, 1, size, (FILE *) stream); 54 50 55 while (offset < size) { 56 if (fputuc(str[chars], (FILE *) stream) <= 0) 57 break; 51 if (errno == EOK && written != size) 52 errno = EIO; 58 53 59 chars++; 60 offset += sizeof(char32_t); 61 } 54 if (errno != EOK) 55 return errno; 62 56 63 return chars; 57 errno = old_errno; 58 return EOK; 64 59 } 65 60 … … 77 72 printf_spec_t ps = { 78 73 vprintf_str_write, 79 vprintf_wstr_write,80 74 stream 81 75 };
Note:
See TracChangeset
for help on using the changeset viewer.