Cleaned up some things

This commit is contained in:
Julian Barathieu 2018-12-25 19:40:32 +01:00
parent f6ea17d9e0
commit fdcf18e988
8 changed files with 33 additions and 14 deletions

View File

@ -37,7 +37,7 @@ char *itoa(int i, char *str, int base)
*str++ = '0'; *str++ = '0';
} }
// compute digits... in reverse order (XXX?) // compute digits... in reverse order
while (i > 0) { while (i > 0) {
*str++ = digits[i % base]; *str++ = digits[i % base];
i /= base; i /= base;

View File

@ -24,16 +24,13 @@ int sprintf(char *str, const char *fmt, ...)
return ret; return ret;
} }
//
// Format str according to fmt, using the va_list ap
//
int vsprintf(char *str, const char *fmt, va_list ap) int vsprintf(char *str, const char *fmt, va_list ap)
{ {
return vsnprintf(str, SIZE_T_MAX, fmt, ap); return vsnprintf(str, SIZE_T_MAX, fmt, ap);
} }
// //
// sprintf() but with a size limit: no more than n bytes are written in str // (v)sprintf() but with a size limit: no more than n bytes are written in str
// XXX null termination behavior? // XXX null termination behavior?
// //
int snprintf(char *str, size_t n, const char *fmt, ...) int snprintf(char *str, size_t n, const char *fmt, ...)
@ -48,9 +45,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...)
return ret; return ret;
} }
//
// snprintf() but arguments
//
int vsnprintf(char *str, size_t n, const char *fmt, va_list ap) int vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
{ {
int ret = 0; int ret = 0;

View File

@ -0,0 +1,12 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Memory allocation routines //
// Only exists to trigger Neox //
//----------------------------------------------------------------------------//
#include "kernel/mm/malloc.h"

View File

@ -0,0 +1,16 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Authors: spectral` //
// NeoX //
// //
// Desc: Memory allocation routines //
//----------------------------------------------------------------------------//
#ifndef _KALKERN_MM_MALLOC_H
#define _KALKERN_MM_MALLOC_H
#include "common/common.h"
#endif

View File

@ -33,7 +33,6 @@ int main(int argc, char *argv[])
#undef strcpy #undef strcpy
assert(strcmp(strcpy(test2, test1), _osk_strcpy(test3, test1)) == 0); assert(strcmp(strcpy(test2, test1), _osk_strcpy(test3, test1)) == 0);
// tests done // tests done
printf("2\n"); printf("2\n");

View File

View File

@ -7,6 +7,8 @@
// Desc: Project Tree // // Desc: Project Tree //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
// XXX *not* up to date
src/ src/
| |
+ boot/ + boot/

View File

@ -1,4 +0,0 @@
make
cp ../bin/bootloader.bin "~/Documents/GNU OSK/bin/bootloader.bin"
qemu-system-x86_64 -hda "~/Documents/GNU OSK/bin/bootloader.bin"
qemu-system-i386 -hda "~/Documents/GNU OSK/bin/bootloader.bin"