mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-07 17:32:45 -04:00
Fix API usage
This commit is contained in:
parent
1a0c46b03d
commit
a4fc6661e3
4 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
#include <kernaux/printf.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -17,7 +18,7 @@ static void my_putchar(const char chr)
|
|||
|
||||
int main()
|
||||
{
|
||||
kernaux_printf(my_putchar, "Hello, %s! Session ID: %u.", "Alex", 123);
|
||||
kernaux_printf(my_putchar, NULL, "Hello, %s! Session ID: %u.", "Alex", 123);
|
||||
assert(strcmp(buffer, "Hello, Alex! Session ID: 123.") == 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <kernaux/printf.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -19,7 +20,7 @@ static void my_printf(const char *const format, ...)
|
|||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
kernaux_printf_va(my_putchar, format, va);
|
||||
kernaux_vprintf(my_putchar, NULL, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <kernaux/printf.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void kernaux_console_putc(const char c __attribute__((unused)))
|
||||
{
|
||||
#ifdef ASM_I386
|
||||
|
@ -37,7 +39,7 @@ void kernaux_console_printf(const char *format, ...)
|
|||
{
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
kernaux_printf_va(kernaux_console_putc, format, va);
|
||||
kernaux_vprintf(kernaux_console_putc, NULL, format, va);
|
||||
va_end(va);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@ static void test(const char *const expected, const char *const format, ...)
|
|||
buffer_index = 0;
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
kernaux_printf_va(test_putchar, format, va);
|
||||
kernaux_vprintf(test_putchar, NULL, format, va);
|
||||
va_end(va);
|
||||
assert(strcmp(expected, buffer) == 0);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ int main()
|
|||
{
|
||||
memset(buffer, '\0', sizeof(buffer));
|
||||
buffer_index = 0;
|
||||
kernaux_printf(test_putchar, "Hello, World!");
|
||||
kernaux_printf(test_putchar, NULL, "Hello, World!");
|
||||
assert(strcmp("Hello, World!", buffer) == 0);
|
||||
|
||||
test("", "");
|
||||
|
|
Loading…
Add table
Reference in a new issue