libc.obj: small fixes
Some checks failed
Build system / Build (pull_request) Failing after 1s
Build system / Check kernel codestyle (pull_request) Successful in 1m7s

This commit is contained in:
2026-01-19 21:34:18 +05:00
parent 2818bf25e2
commit de8b5f9993
3 changed files with 15 additions and 9 deletions

View File

@@ -4,11 +4,13 @@
#include <stdio.h>
#include <stdlib.h>
//#include "format_print.h"
// #include "format_print.h"
int printf(const char *format, ...)
int printf(const char* format, ...)
{
va_list arg;
va_start(arg, format);
return vprintf(format, arg);
va_list arg;
va_start(arg, format);
int ret = vprintf(format, arg);
va_end(arg);
return ret;
}

View File

@@ -3,7 +3,9 @@
void* calloc(size_t num, size_t size)
{
void* ptr = malloc(num * size); // malloc сам в __errno насрет, если надо будет
memset(ptr, 0, num * size);
void* ptr = malloc(num * size);
if (ptr) {
memset(ptr, 0, num * size);
}
return ptr;
}

View File

@@ -4,7 +4,9 @@
char* strdup(const char* str)
{
char* buf = malloc(strlen(str) + 1);
buf[strlen(str)] = '\0';
strcpy(buf, str);
if (buf) {
buf[strlen(str)] = '\0';
strcpy(buf, str);
}
return buf;
}