Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/printf/vprintf.c

    r163e34c r28a5ebd  
    3333 */
    3434
     35#include <print.h>
     36#include <printf/printf_core.h>
     37#include <putchar.h>
     38#include <synch/spinlock.h>
    3539#include <arch/asm.h>
    36 #include <console/console.h>
    37 #include <print.h>
    38 #include <printf_core.h>
    39 #include <putchar.h>
     40#include <typedefs.h>
    4041#include <str.h>
    41 #include <synch/spinlock.h>
    42 #include <typedefs.h>
    4342
    44 static errno_t vprintf_str_write(const char *str, size_t size, void *data)
     43static int vprintf_str_write(const char *str, size_t size, void *data)
    4544{
    4645        size_t offset = 0;
     46        size_t chars = 0;
    4747
    48         while (offset < size)
     48        while (offset < size) {
    4949                putuchar(str_decode(str, &offset, size));
     50                chars++;
     51        }
    5052
    51         return EOK;
     53        return chars;
     54}
     55
     56static 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;
    5268}
    5369
     
    5874        char32_t uc;
    5975
    60         console_lock();
    61 
    6276        while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
    6377                putuchar(uc);
     
    6680
    6781        putuchar('\n');
    68 
    69         console_unlock();
    7082        return chars;
    7183}
     
    7587        printf_spec_t ps = {
    7688                vprintf_str_write,
     89                vprintf_wstr_write,
    7790                NULL
    7891        };
    7992
    80         console_lock();
    81         int ret = printf_core(fmt, &ps, ap);
    82         console_unlock();
    83         return ret;
     93        return printf_core(fmt, &ps, ap);
    8494}
    8595
Note: See TracChangeset for help on using the changeset viewer.