This commit is contained in:
Julian Barathieu 2019-05-07 23:16:56 +02:00
parent 241eeb64cb
commit 39e46a072f
18 changed files with 364 additions and 102 deletions

View File

@ -37,7 +37,7 @@ CCNAME=x86_64-elf-gcc
ASMFLAGS=-f elf64 ASMFLAGS=-f elf64
LDFLAGS=-melf_x86_64 LDFLAGS=-melf_x86_64
COPTIM=-O2 COPTIM=-O2
CWARNS=-Wall -Wextra -Werror=implicit-function-declaration CWARNS=-Wall -Wextra -Wno-unused-parameter -Werror=implicit-function-declaration
CINCLUDES=-Iinclude CINCLUDES=-Iinclude
CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11
CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2 CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2
@ -74,19 +74,22 @@ NC='\033[1;37m'
## SOURCES INSCRIPTION-------------------------------------------------------- # ## SOURCES INSCRIPTION-------------------------------------------------------- #
# Lib C sources # Lib C sources + libbuf source
LibCSources = libc/atoi.c libc/itoa.c \ LibCSources = libc/atoi.c libc/itoa.c \
libc/mem.c libc/ctype.c \ libc/mem.c libc/ctype.c \
libc/rand.c libc/sprintf.c \ libc/rand.c libc/sprintf.c \
libc/status.c libc/string.c \ libc/status.c libc/string.c \
libc/strtol.c extras/argv.c \ libc/strtol.c extras/argv.c \
extras/prog.c libbuf/bopen.c libbuf/bputc.c libbuf/bscroll.c \
libbuf/bprint.c libbuf/bgetc.c libbuf/bscan.c \
libbuf/bflush.c libbuf/bwrite.c libbuf/bread.c \
libbuf/bmisc.c libbuf/bclose.c \
extras/prog.c \
KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources)) KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources))
# Kernel sources # Kernel sources
KernSources = libbuf/buf.c libbuf/bputc.c libbuf/bscroll.c \ KernSources = kernel/cpu/cpuid.c \
libbuf/bprint.c kernel/cpu/cpuid.c \
kernel/cpu/idt.c kernel/init/init.c \ kernel/cpu/idt.c kernel/init/init.c \
kernel/init/table.c kernel/io/cursor.c \ kernel/init/table.c kernel/io/cursor.c \
kernel/ke/log.c kernel/io/vga.c \ kernel/ke/log.c kernel/io/vga.c \

View File

@ -71,6 +71,7 @@
│   │   │   │   ├── cursor.o │   │   │   │   ├── cursor.o
│   │   │   │   ├── keyb.o │   │   │   │   ├── keyb.o
│   │   │   │   ├── rtc.o │   │   │   │   ├── rtc.o
│   │   │   │   ├── spkr.o
│   │   │   │   └── vga.o │   │   │   │   └── vga.o
│   │   │   ├── ke │   │   │   ├── ke
│   │   │   │   ├── log.o │   │   │   │   ├── log.o
@ -129,6 +130,7 @@
│   │   ├── mm.h │   │   ├── mm.h
│   │   ├── proc.h │   │   ├── proc.h
│   │   ├── sched.h │   │   ├── sched.h
│   │   ├── speaker.h
│   │   └── time.h │   │   └── time.h
│   ├── kalbase.h │   ├── kalbase.h
│   ├── kaleid.h │   ├── kaleid.h
@ -153,6 +155,7 @@
│   │   │   ├── cursor.c │   │   │   ├── cursor.c
│   │   │   ├── keyb.c │   │   │   ├── keyb.c
│   │   │   ├── rtc.c │   │   │   ├── rtc.c
│   │   │   ├── spkr.c
│   │   │   └── vga.c │   │   │   └── vga.c
│   │   ├── ke │   │   ├── ke
│   │   │   ├── log.c │   │   │   ├── log.c
@ -165,6 +168,7 @@
│   │   └── ps │   │   └── ps
│   │   └── sched.c │   │   └── sched.c
│   ├── libbuf │   ├── libbuf
│   │   ├── bgetc.c
│   │   ├── bprint.c │   │   ├── bprint.c
│   │   ├── bputc.c │   │   ├── bputc.c
│   │   ├── bscroll.c │   │   ├── bscroll.c
@ -188,4 +192,4 @@
├── ProjectTree ├── ProjectTree
└── README.md └── README.md
37 directories, 126 files 37 directories, 130 files

View File

@ -69,7 +69,7 @@ typedef struct Buffer_t Buffer_t;
// When a buffer is full, if the flusher doesn'tchange buf->wp and bputc() // When a buffer is full, if the flusher doesn'tchange buf->wp and bputc()
// is called again, it will produce a EENDF error and set the BF_EOF flag // is called again, it will produce a EENDF error and set the BF_EOF flag
// //
// Unless line buffering with auto-scrolldown enabled, nothing is // Unless terminal buffering with auto-scrolldown enabled, nothing is
// removed from the buffer by the libbuf functions themselves, if you want // removed from the buffer by the libbuf functions themselves, if you want
// the buffer to be emptied on flush then do that in the flusher // the buffer to be emptied on flush then do that in the flusher
// //
@ -115,8 +115,8 @@ void BDisableAutoScroll(Buffer_t *);
// 'source' is the internal buffer, if you want // 'source' is the internal buffer, if you want
// to give it yourself // to give it yourself
// //
// If *pbuf==NULL, malloc's the structure
// If source==NULL, malloc's the buffer // If source==NULL, malloc's the buffer
// If *pbuf==NULL, malloc's the structure (Ex's only)
// BCloseBuf() handles the de-allocations // BCloseBuf() handles the de-allocations
// //
error_t BCloseBuf(Buffer_t *); error_t BCloseBuf(Buffer_t *);
@ -137,19 +137,36 @@ int BGetFlags(Buffer_t *);
int BGetState(Buffer_t *); int BGetState(Buffer_t *);
error_t BFlushBuf(Buffer_t *); error_t BFlushBuf(Buffer_t *);
error_t BPutOnBuf(Buffer_t *, uchar); error_t BPutOnBuf(Buffer_t *, uchar);
error_t BPrintOnBuf(Buffer_t *, const char *fmt, ...); error_t BWriteOnBuf(Buffer_t *, uchar *, size_t); // TODO
error_t BPrintOnBufV(Buffer_t *, const char *fmt, va_list); error_t BPrintOnBuf(Buffer_t *, const char *, ...);
error_t BPrintOnBufV(Buffer_t *, const char *, va_list);
error_t BGetFromBuf(Buffer_t *, uchar *);
error_t BReadBuf(Buffer_t *, uchar *, size_t);
error_t BScanBuf(Buffer_t *, const char *, ...);
error_t BScanBufV(Buffer_t *, const char *, va_list);
void BLockBuf(Buffer_t *); void BLockBuf(Buffer_t *);
void BUnlockBuf(Buffer_t *); void BUnlockBuf(Buffer_t *);
bool BTrylockBuf(Buffer_t *); bool BTrylockBuf(Buffer_t *);
// Internal, non-locking functions; don't use unless you //
// have a good reason why // Non-locking functions, also perform less checks
error_t bputc(Buffer_t *buf, uchar ch); // Only use when not caring about locks, or between BLockBuf()/BUnlockBuf()
error_t bprintf(Buffer_t *buf, const char *fmt, ...); //
error_t vbprintf(Buffer_t *buf, const char *fmt, va_list ap);
error_t bputc(Buffer_t *, uchar);
error_t bwrite(Buffer_t *, uchar *, size_t);
error_t bprintf(Buffer_t *, const char *, ...);
error_t vbprintf(Buffer_t *, const char *, va_list);
error_t bgetc(Buffer_t *, uchar *);
error_t bread(Buffer_t *, uchar *, size_t);
error_t bscanf(Buffer_t *, const char *, ...);
error_t vbscanf(Buffer_t *, const char *, va_list);
error_t bscrolldown(Buffer_t *buf); error_t bscrolldown(Buffer_t *buf);
#endif #endif

View File

@ -26,13 +26,9 @@
#include <kalbase.h> #include <kalbase.h>
#endif #endif
//------------------------------------------//
#ifndef _KALEXT_H #ifndef _KALEXT_H
#define _KALEXT_H #define _KALEXT_H
//------------------------------------------//
// Extra headers //
//------------------------------------------// //------------------------------------------//
#ifndef _KALEXTRAS_LOCKS_H #ifndef _KALEXTRAS_LOCKS_H

View File

@ -170,6 +170,8 @@ noreturn void KeStartPanic(const char *, ...);
#define BUG() XBUG('B') #define BUG() XBUG('B')
#define BUGON(x) if(x)BUG() #define BUGON(x) if(x)BUG()
//----------------------------------------------------------------------------//
#define __GET_GETRIP() \ #define __GET_GETRIP() \
__attribute__((__noinline__)) \ __attribute__((__noinline__)) \
static ulong __getrip() \ static ulong __getrip() \

View File

@ -97,6 +97,12 @@ error_t IdtRegisterIsr(void (*isr)(ISRFrame_t *regs), uchar isrNo);
static inline void IoWriteByteOnPort(port_t port, uchar val) static inline void IoWriteByteOnPort(port_t port, uchar val)
{ asm volatile ("outb %1, %0" : : "dN" (port), "a" (val)); } { asm volatile ("outb %1, %0" : : "dN" (port), "a" (val)); }
static inline void IoWriteWordOnPort(port_t port, ushort val)
{ asm volatile ("outw %1, %0" : : "dN" (port), "a" (val)); }
static inline void IoWriteDWordOnPort(port_t port, uint val)
{ asm volatile ("outl %1, %0" : : "dN" (port), "a" (val)); }
static inline uchar IoReadByteFromPort(port_t port) { static inline uchar IoReadByteFromPort(port_t port) {
uchar ret; uchar ret;
asm volatile ("inb %1, %0" : "=a"(ret) : "Nd"(port)); asm volatile ("inb %1, %0" : "=a"(ret) : "Nd"(port));

View File

@ -31,6 +31,7 @@ char ScanCodes[100] = { 0 };
void KeybPrint(char code) void KeybPrint(char code)
{ {
if (code) { if (code) {
bputc(BStdIn, ScanCodes[(int)code]);
bputc(BStdOut, ScanCodes[(int)code]); bputc(BStdOut, ScanCodes[(int)code]);
//bprintf(BStdOut, "%x ", code); //bprintf(BStdOut, "%x ", code);
BStdOut->flusher(BStdOut); BStdOut->flusher(BStdOut);

View File

@ -46,6 +46,9 @@ error_t KalAllocMemoryEx(void **ptr, size_t req, int flags, size_t align)
brk = (size_t)_heap_start + MmGetHeapSize(); brk = (size_t)_heap_start + MmGetHeapSize();
req = _ALIGN_UP(req + brk, align) - brk; req = _ALIGN_UP(req + brk, align) - brk;
//DebugLog("MALLOC: start=%p, size=%lx, brk=%p, req=%lx\n",
// _heap_start, MmGetHeapSize(), brk, req);
rc = MmGrowHeap(req); rc = MmGrowHeap(req);
MmUnlockHeap(); MmUnlockHeap();

55
kaleid/libbuf/bclose.c Normal file
View File

@ -0,0 +1,55 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>
//
// Closes a buffer, not flushing unless the proper flag is set
//
error_t BCloseBuf(Buffer_t *buf)
{
assert(buf && buf->initDone == INITOK);
ExAcquireLock(&buf->lock);
if (buf->flags & BF_FONCLOSE) {
BFlushBuf(buf);
}
if (buf->flags & BF_SALLOC && buf->buf) {
free(buf->buf);
}
buf->buf = buf->rp = buf->wp = NULL;
buf->initDone = buf->flags = buf->state = buf->size = 0;
ExReleaseLock(&buf->lock);
if (buf->flags & BF_BALLOC) {
free(buf);
}
return EOK;
}

51
kaleid/libbuf/bflush.c Normal file
View File

@ -0,0 +1,51 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>
//
// Flushes a buffer, returns EBADF when not possible
//
error_t BFlushBuf(Buffer_t *buf)
{
error_t rc;
assert(buf && buf->initDone == INITOK);
if (!buf) return EINVAL;
if (buf->flags & (BF_EOF|BF_ERR)) {
return EENDF;
}
if (!buf->flusher) {
return EBADF;
}
ExAcquireLock(&buf->lock);
rc = buf->flusher(buf);
ExReleaseLock(&buf->lock);
return rc;
}

View File

@ -0,0 +1,52 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>
error_t BGetFromBuf(Buffer_t *buf, uchar *ch)
{
error_t rc;
assert(buf && buf->initDone == INITOK);
if (!buf) return EINVAL;
if (buf->state != BS_RDWR && buf->state != BS_RDONLY) {
return EBADF;
}
ExAcquireLock(&buf->lock);
rc = bgetc(buf, ch);
ExReleaseLock(&buf->lock);
return rc;
}
error_t bgetc(Buffer_t *buf, uchar *ch)
{
error_t rc = EOK;
if (buf->flags & (BF_EOF|BF_ERR)) return EENDF;
return EOK;
}

52
kaleid/libbuf/bmisc.c Normal file
View File

@ -0,0 +1,52 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>
// Straightforward functions
int BGetFlags(Buffer_t *buf) { return buf->flags; }
int BGetState(Buffer_t *buf) { return buf->state; }
void BEnableLineBuffering(Buffer_t *buf)
{
assert(buf && !(buf->flags & BF_TERM));
buf->flags |= BF_LINE;
}
void BDisaleLineBuffering(Buffer_t *buf)
{
assert(buf && !(buf->flags & BF_TERM));
buf->flags &= ~BF_LINE;
}
void BLockBuf(Buffer_t *buf)
{
assert(buf && buf->initDone == INITOK);
ExAcquireLock(&buf->lock);
}
void BUnlockBuf(Buffer_t *buf) { ExReleaseLock(&buf->lock); }
bool BTrylockBuf(Buffer_t *buf) { return ExAttemptLock(&buf->lock); }

View File

@ -26,68 +26,18 @@
#include <extras/locks.h> #include <extras/locks.h>
#include <extras/malloc.h> #include <extras/malloc.h>
#include <kernel/base.h>
Buffer_t *BStdIn, *BStdOut, *BStdDbg; Buffer_t *BStdIn, *BStdOut, *BStdDbg;
// Straightforward functions
int BGetFlags(Buffer_t *buf) { return buf->flags; }
int BGetState(Buffer_t *buf) { return buf->state; }
void BEnableLineBuffering(Buffer_t *buf)
{
assert(buf && !(buf->flags & BF_TERM));
buf->flags |= BF_LINE;
}
void BDisaleLineBuffering(Buffer_t *buf)
{
assert(buf && !(buf->flags & BF_TERM));
buf->flags &= ~BF_LINE;
}
void BLockBuf(Buffer_t *buf)
{
assert(buf && buf->initDone == INITOK);
ExAcquireLock(&buf->lock);
}
void BUnlockBuf(Buffer_t *buf) { ExReleaseLock(&buf->lock); }
bool BTrylockBuf(Buffer_t *buf) { return ExAttemptLock(&buf->lock); }
//
// Closes a buffer, not flushing unless the proper flag is set
//
error_t BCloseBuf(Buffer_t *buf)
{
assert(buf && buf->initDone == INITOK);
ExAcquireLock(&buf->lock);
if (buf->flags & BF_FONCLOSE) {
BFlushBuf(buf);
}
if (buf->flags & BF_SALLOC && buf->buf) {
KalFreeMemory(buf->buf);
}
buf->buf = buf->rp = buf->wp = NULL;
buf->initDone = buf->flags = buf->state = buf->size = 0;
ExReleaseLock(&buf->lock);
if (buf->flags & BF_BALLOC) {
KalFreeMemory(buf);
}
return EOK;
}
// //
// Creates an actual buffer // Creates an actual buffer
// //
error_t BOpenPureBuf(Buffer_t **pbuf, int mode, size_t size) error_t BOpenPureBuf(Buffer_t **pbuf, int mode, size_t size)
{ {
if (*pbuf != NULL) {
assert(0);
return EINVAL;
}
return BOpenPureBufEx(pbuf, NULL, mode, size, NULL); return BOpenPureBufEx(pbuf, NULL, mode, size, NULL);
} }
@ -145,6 +95,10 @@ error_t BOpenPureBufEx(Buffer_t **pbuf, char *source, int mode, size_t size,
error_t BOpenTermBuf(Buffer_t **pbuf, int mode, error_t BOpenTermBuf(Buffer_t **pbuf, int mode,
int lineLen, int nLines, int pbCount) int lineLen, int nLines, int pbCount)
{ {
if (*pbuf != NULL) {
assert(0);
return EINVAL;
}
return BOpenTermBufEx(pbuf, NULL, mode, lineLen, nLines, pbCount, NULL); return BOpenTermBufEx(pbuf, NULL, mode, lineLen, nLines, pbCount, NULL);
} }
@ -168,26 +122,3 @@ error_t BOpenTermBufEx(Buffer_t **pbuf, char *source, int mode,
return rc; return rc;
} }
//
// Flushes a buffer, returns EBADF when not possible
//
error_t BFlushBuf(Buffer_t *buf)
{
error_t rc;
assert(buf && buf->initDone == INITOK);
if (!buf) return EINVAL;
if (buf->flags & (BF_EOF|BF_ERR)) {
return EENDF;
}
if (!buf->flusher) {
return EBADF;
}
ExAcquireLock(&buf->lock);
rc = buf->flusher(buf);
ExReleaseLock(&buf->lock);
return rc;
}

39
kaleid/libbuf/bread.c Normal file
View File

@ -0,0 +1,39 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>
error_t BReadBuf(Buffer_t *buf, uchar *out, size_t n)
{
error_t rc;
}
error_t bread(Buffer_t *buf, uchar * out, size_t n)
{
}

27
kaleid/libbuf/bscan.c Normal file
View File

@ -0,0 +1,27 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>

27
kaleid/libbuf/bwrite.c Normal file
View File

@ -0,0 +1,27 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Buffer library //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <extras/buf.h>
#include <extras/locks.h>

View File

@ -25,8 +25,6 @@
#include <kalbase.h> #include <kalbase.h>
#include <extras/malloc.h> #include <extras/malloc.h>
#include<kernel/heap.h>
/* DO NOT compile with strict aliasing on */ /* DO NOT compile with strict aliasing on */
//------------------------------------------// //------------------------------------------//

View File

@ -75,12 +75,11 @@ size_t snprintf(char *str, size_t n, const char *fmt, ...)
return ret; return ret;
} }
__GET_GETRIP();
size_t vsnprintf(char *str, size_t n, const char *fmt, va_list ap) size_t vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
{ {
size_t ret; size_t ret;
error_t rc; error_t rc;
Buffer_t *buf; Buffer_t *buf = NULL;
assert(str && fmt); assert(str && fmt);
@ -110,7 +109,6 @@ size_t vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
str[ret++] = 0; str[ret++] = 0;
assert(ret <= n); assert(ret <= n);
//109e38 101c63
BCloseBuf(buf); BCloseBuf(buf);
return ret; return ret;