Changeset 163e34c in mainline for uspace/lib/c/generic/io/asprintf.c


Ignore:
Timestamp:
2025-04-13T19:33:48Z (3 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
f5e1692
Parents:
97f6b71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-13 18:56:51)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-13 19:33:48)
Message:

Actually convert the printf outputs everywhere

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/asprintf.c

    r97f6b71 r163e34c  
    4040#include <str.h>
    4141#include <printf_core.h>
    42 
    43 static int asprintf_str_write(const char *str, size_t count, void *unused)
    44 {
    45         return str_nlength(str, count);
    46 }
    47 
    48 static int asprintf_wstr_write(const char32_t *str, size_t count, void *unused)
    49 {
    50         return wstr_nlength(str, count);
    51 }
    52 
    53 int vprintf_length(const char *fmt, va_list args)
    54 {
    55         printf_spec_t ps = {
    56                 asprintf_str_write,
    57                 asprintf_wstr_write,
    58                 NULL
    59         };
    60 
    61         return printf_core(fmt, &ps, args);
    62 }
    63 
    64 int printf_length(const char *fmt, ...)
    65 {
    66         va_list args;
    67         va_start(args, fmt);
    68         int ret = vprintf_length(fmt, args);
    69         va_end(args);
    70 
    71         return ret;
    72 }
    7342
    7443/** Allocate and print to string.
     
    11584        int ret = vasprintf(strp, fmt, args);
    11685        va_end(args);
    117 
    11886        return ret;
    11987}
Note: See TracChangeset for help on using the changeset viewer.