From 39e46a072fe98a143ab0deebd60d8f9380c5b8f2 Mon Sep 17 00:00:00 2001 From: Julian Barathieu Date: Tue, 7 May 2019 23:16:56 +0200 Subject: [PATCH] stuff --- Makefile | 13 +++-- ProjectTree | 6 ++- include/extras/buf.h | 35 +++++++++---- include/kalext.h | 4 -- include/kernel/base.h | 2 + include/kernel/iomisc.h | 6 +++ kaleid/kernel/io/keyb.c | 1 + kaleid/kernel/mm/malloc.c | 3 ++ kaleid/libbuf/bclose.c | 55 ++++++++++++++++++++ kaleid/libbuf/bflush.c | 51 +++++++++++++++++++ kaleid/libbuf/bgetc.c | 52 +++++++++++++++++++ kaleid/libbuf/bmisc.c | 52 +++++++++++++++++++ kaleid/libbuf/{buf.c => bopen.c} | 87 ++++---------------------------- kaleid/libbuf/bread.c | 39 ++++++++++++++ kaleid/libbuf/bscan.c | 27 ++++++++++ kaleid/libbuf/bwrite.c | 27 ++++++++++ kaleid/libc/mem.c | 2 - kaleid/libc/sprintf.c | 4 +- 18 files changed, 364 insertions(+), 102 deletions(-) create mode 100644 kaleid/libbuf/bclose.c create mode 100644 kaleid/libbuf/bflush.c create mode 100644 kaleid/libbuf/bmisc.c rename kaleid/libbuf/{buf.c => bopen.c} (71%) create mode 100644 kaleid/libbuf/bread.c create mode 100644 kaleid/libbuf/bscan.c create mode 100644 kaleid/libbuf/bwrite.c diff --git a/Makefile b/Makefile index 3b51bce..64e8552 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ CCNAME=x86_64-elf-gcc ASMFLAGS=-f elf64 LDFLAGS=-melf_x86_64 COPTIM=-O2 -CWARNS=-Wall -Wextra -Werror=implicit-function-declaration +CWARNS=-Wall -Wextra -Wno-unused-parameter -Werror=implicit-function-declaration CINCLUDES=-Iinclude CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2 @@ -74,19 +74,22 @@ NC='\033[1;37m' ## SOURCES INSCRIPTION-------------------------------------------------------- # -# Lib C sources +# Lib C sources + libbuf source LibCSources = libc/atoi.c libc/itoa.c \ libc/mem.c libc/ctype.c \ libc/rand.c libc/sprintf.c \ libc/status.c libc/string.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)) # Kernel sources -KernSources = libbuf/buf.c libbuf/bputc.c libbuf/bscroll.c \ - libbuf/bprint.c kernel/cpu/cpuid.c \ +KernSources = kernel/cpu/cpuid.c \ kernel/cpu/idt.c kernel/init/init.c \ kernel/init/table.c kernel/io/cursor.c \ kernel/ke/log.c kernel/io/vga.c \ diff --git a/ProjectTree b/ProjectTree index e804085..29ddd18 100644 --- a/ProjectTree +++ b/ProjectTree @@ -71,6 +71,7 @@ │   │   │   │   ├── cursor.o │   │   │   │   ├── keyb.o │   │   │   │   ├── rtc.o +│   │   │   │   ├── spkr.o │   │   │   │   └── vga.o │   │   │   ├── ke │   │   │   │   ├── log.o @@ -129,6 +130,7 @@ │   │   ├── mm.h │   │   ├── proc.h │   │   ├── sched.h +│   │   ├── speaker.h │   │   └── time.h │   ├── kalbase.h │   ├── kaleid.h @@ -153,6 +155,7 @@ │   │   │   ├── cursor.c │   │   │   ├── keyb.c │   │   │   ├── rtc.c +│   │   │   ├── spkr.c │   │   │   └── vga.c │   │   ├── ke │   │   │   ├── log.c @@ -165,6 +168,7 @@ │   │   └── ps │   │   └── sched.c │   ├── libbuf +│   │   ├── bgetc.c │   │   ├── bprint.c │   │   ├── bputc.c │   │   ├── bscroll.c @@ -188,4 +192,4 @@ ├── ProjectTree └── README.md -37 directories, 126 files +37 directories, 130 files diff --git a/include/extras/buf.h b/include/extras/buf.h index 5f68e98..147a040 100644 --- a/include/extras/buf.h +++ b/include/extras/buf.h @@ -69,7 +69,7 @@ typedef struct Buffer_t Buffer_t; // 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 // -// 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 // 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 // to give it yourself // -// If *pbuf==NULL, malloc's the structure // If source==NULL, malloc's the buffer +// If *pbuf==NULL, malloc's the structure (Ex's only) // BCloseBuf() handles the de-allocations // error_t BCloseBuf(Buffer_t *); @@ -137,19 +137,36 @@ int BGetFlags(Buffer_t *); int BGetState(Buffer_t *); error_t BFlushBuf(Buffer_t *); + error_t BPutOnBuf(Buffer_t *, uchar); -error_t BPrintOnBuf(Buffer_t *, const char *fmt, ...); -error_t BPrintOnBufV(Buffer_t *, const char *fmt, va_list); +error_t BWriteOnBuf(Buffer_t *, uchar *, size_t); // TODO +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 BUnlockBuf(Buffer_t *); bool BTrylockBuf(Buffer_t *); -// Internal, non-locking functions; don't use unless you -// have a good reason why -error_t bputc(Buffer_t *buf, uchar ch); -error_t bprintf(Buffer_t *buf, const char *fmt, ...); -error_t vbprintf(Buffer_t *buf, const char *fmt, va_list ap); +// +// Non-locking functions, also perform less checks +// Only use when not caring about locks, or between BLockBuf()/BUnlockBuf() +// + +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); #endif diff --git a/include/kalext.h b/include/kalext.h index a83afe1..ccd1011 100644 --- a/include/kalext.h +++ b/include/kalext.h @@ -26,13 +26,9 @@ #include #endif -//------------------------------------------// - #ifndef _KALEXT_H #define _KALEXT_H -//------------------------------------------// -// Extra headers // //------------------------------------------// #ifndef _KALEXTRAS_LOCKS_H diff --git a/include/kernel/base.h b/include/kernel/base.h index 9069a04..4927b10 100644 --- a/include/kernel/base.h +++ b/include/kernel/base.h @@ -170,6 +170,8 @@ noreturn void KeStartPanic(const char *, ...); #define BUG() XBUG('B') #define BUGON(x) if(x)BUG() +//----------------------------------------------------------------------------// + #define __GET_GETRIP() \ __attribute__((__noinline__)) \ static ulong __getrip() \ diff --git a/include/kernel/iomisc.h b/include/kernel/iomisc.h index d37bd91..28f639a 100644 --- a/include/kernel/iomisc.h +++ b/include/kernel/iomisc.h @@ -97,6 +97,12 @@ error_t IdtRegisterIsr(void (*isr)(ISRFrame_t *regs), uchar isrNo); static inline void IoWriteByteOnPort(port_t port, uchar 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) { uchar ret; asm volatile ("inb %1, %0" : "=a"(ret) : "Nd"(port)); diff --git a/kaleid/kernel/io/keyb.c b/kaleid/kernel/io/keyb.c index 7a3a2b4..721280c 100644 --- a/kaleid/kernel/io/keyb.c +++ b/kaleid/kernel/io/keyb.c @@ -31,6 +31,7 @@ char ScanCodes[100] = { 0 }; void KeybPrint(char code) { if (code) { + bputc(BStdIn, ScanCodes[(int)code]); bputc(BStdOut, ScanCodes[(int)code]); //bprintf(BStdOut, "%x ", code); BStdOut->flusher(BStdOut); diff --git a/kaleid/kernel/mm/malloc.c b/kaleid/kernel/mm/malloc.c index a00348a..e873ca4 100644 --- a/kaleid/kernel/mm/malloc.c +++ b/kaleid/kernel/mm/malloc.c @@ -45,6 +45,9 @@ error_t KalAllocMemoryEx(void **ptr, size_t req, int flags, size_t align) brk = (size_t)_heap_start + MmGetHeapSize(); 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); diff --git a/kaleid/libbuf/bclose.c b/kaleid/libbuf/bclose.c new file mode 100644 index 0000000..eedbe0d --- /dev/null +++ b/kaleid/libbuf/bclose.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + +// +// 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; +} + diff --git a/kaleid/libbuf/bflush.c b/kaleid/libbuf/bflush.c new file mode 100644 index 0000000..e852cdc --- /dev/null +++ b/kaleid/libbuf/bflush.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + +// +// 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; +} + diff --git a/kaleid/libbuf/bgetc.c b/kaleid/libbuf/bgetc.c index e69de29..6577c06 100644 --- a/kaleid/libbuf/bgetc.c +++ b/kaleid/libbuf/bgetc.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + +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; +} + diff --git a/kaleid/libbuf/bmisc.c b/kaleid/libbuf/bmisc.c new file mode 100644 index 0000000..a05fddb --- /dev/null +++ b/kaleid/libbuf/bmisc.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + +// 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); } + diff --git a/kaleid/libbuf/buf.c b/kaleid/libbuf/bopen.c similarity index 71% rename from kaleid/libbuf/buf.c rename to kaleid/libbuf/bopen.c index 2e10b07..4a5f395 100644 --- a/kaleid/libbuf/buf.c +++ b/kaleid/libbuf/bopen.c @@ -26,68 +26,18 @@ #include #include -#include - 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 // 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); } @@ -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, int lineLen, int nLines, int pbCount) { + if (*pbuf != NULL) { + assert(0); + return EINVAL; + } 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; } -// -// 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; -} diff --git a/kaleid/libbuf/bread.c b/kaleid/libbuf/bread.c new file mode 100644 index 0000000..38cbc21 --- /dev/null +++ b/kaleid/libbuf/bread.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + +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) +{ + +} + diff --git a/kaleid/libbuf/bscan.c b/kaleid/libbuf/bscan.c new file mode 100644 index 0000000..3e17873 --- /dev/null +++ b/kaleid/libbuf/bscan.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + diff --git a/kaleid/libbuf/bwrite.c b/kaleid/libbuf/bwrite.c new file mode 100644 index 0000000..3e17873 --- /dev/null +++ b/kaleid/libbuf/bwrite.c @@ -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 . // +//----------------------------------------------------------------------------// + +#include +#include + diff --git a/kaleid/libc/mem.c b/kaleid/libc/mem.c index 67b740f..2995dd2 100644 --- a/kaleid/libc/mem.c +++ b/kaleid/libc/mem.c @@ -25,8 +25,6 @@ #include #include -#include - /* DO NOT compile with strict aliasing on */ //------------------------------------------// diff --git a/kaleid/libc/sprintf.c b/kaleid/libc/sprintf.c index 85dd29e..6fa46e2 100644 --- a/kaleid/libc/sprintf.c +++ b/kaleid/libc/sprintf.c @@ -75,12 +75,11 @@ size_t snprintf(char *str, size_t n, const char *fmt, ...) return ret; } -__GET_GETRIP(); size_t vsnprintf(char *str, size_t n, const char *fmt, va_list ap) { size_t ret; error_t rc; - Buffer_t *buf; + Buffer_t *buf = NULL; assert(str && fmt); @@ -110,7 +109,6 @@ size_t vsnprintf(char *str, size_t n, const char *fmt, va_list ap) str[ret++] = 0; assert(ret <= n); -//109e38 101c63 BCloseBuf(buf); return ret;