Changes in kernel/generic/src/printf/vprintf.c [28a5ebd:163e34c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/printf/vprintf.c
r28a5ebd r163e34c 33 33 */ 34 34 35 #include <arch/asm.h> 36 #include <console/console.h> 35 37 #include <print.h> 36 #include <printf /printf_core.h>38 #include <printf_core.h> 37 39 #include <putchar.h> 40 #include <str.h> 38 41 #include <synch/spinlock.h> 39 #include <arch/asm.h>40 42 #include <typedefs.h> 41 #include <str.h>42 43 43 static int vprintf_str_write(const char *str, size_t size, void *data)44 static errno_t vprintf_str_write(const char *str, size_t size, void *data) 44 45 { 45 46 size_t offset = 0; 46 size_t chars = 0;47 47 48 while (offset < size) {48 while (offset < size) 49 49 putuchar(str_decode(str, &offset, size)); 50 chars++;51 }52 50 53 return chars; 54 } 55 56 static int vprintf_wstr_write(const char32_t *str, size_t size, void *data) 57 { 58 size_t offset = 0; 59 size_t chars = 0; 60 61 while (offset < size) { 62 putuchar(str[chars]); 63 chars++; 64 offset += sizeof(char32_t); 65 } 66 67 return chars; 51 return EOK; 68 52 } 69 53 … … 74 58 char32_t uc; 75 59 60 console_lock(); 61 76 62 while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) { 77 63 putuchar(uc); … … 80 66 81 67 putuchar('\n'); 68 69 console_unlock(); 82 70 return chars; 83 71 } … … 87 75 printf_spec_t ps = { 88 76 vprintf_str_write, 89 vprintf_wstr_write,90 77 NULL 91 78 }; 92 79 93 return printf_core(fmt, &ps, ap); 80 console_lock(); 81 int ret = printf_core(fmt, &ps, ap); 82 console_unlock(); 83 return ret; 94 84 } 95 85
Note:
See TracChangeset
for help on using the changeset viewer.