refactor, libc made optional
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#include "../std.h"
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <tgmath.h>
|
||||
|
||||
void *com_std_realloc(void *ptr, size_t size) { return realloc(ptr, size); }
|
||||
void com_std_free(void *ptr) { free(ptr); }
|
||||
void com_std_assert(bool holds) { assert(holds); }
|
||||
void com_std_printf(char const *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
double com_std_sqrt(double v) { return sqrt(v); }
|
||||
double com_std_fabs(double v) { return fabs(v); }
|
||||
double com_std_sin(double v) { return sin(v); }
|
||||
double com_std_cos(double v) { return cos(v); }
|
||||
@@ -0,0 +1,10 @@
|
||||
#include "../std.h"
|
||||
|
||||
void *com_std_realloc(void *ptr, size_t size) { return NULL; }
|
||||
void com_std_free(void *ptr) {}
|
||||
void com_std_assert(bool holds) {}
|
||||
void com_std_printf(char const *fmt, ...) {}
|
||||
double com_std_sqrt(double v) { return 0; }
|
||||
double com_std_fabs(double v) { return 0; }
|
||||
double com_std_sin(double v) { return 0; }
|
||||
double com_std_cos(double v) { return 0; }
|
||||
Reference in New Issue
Block a user