mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-04 12:14:19 +01:00
Global: remove stb_printf
Doesn't gain any performance boost
This commit is contained in:
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"home": "https://github.com/nothings/stb/blob/master/stb_sprintf.h",
|
||||
"license": "MIT or Public domain (embed in source)",
|
||||
"version": "v1.10",
|
||||
"author": "nothings",
|
||||
"patches": [
|
||||
"https://github.com/nothings/stb/pull/1695"
|
||||
]
|
||||
}
|
||||
Vendored
-1906
File diff suppressed because it is too large
Load Diff
@@ -266,9 +266,6 @@ void ffListFeatures(void)
|
||||
#if FF_HAVE_EMBEDDED_PCIIDS
|
||||
"Embedded pciids\n"
|
||||
#endif
|
||||
#if FF_USE_STBPRINTF
|
||||
"stb_printf\n"
|
||||
#endif
|
||||
""
|
||||
, stdout);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#include <sysinfoapi.h>
|
||||
#endif
|
||||
|
||||
#include "util/stb_printf.h"
|
||||
|
||||
static inline double ffTimeGetTick(void) //In msec
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -20,15 +20,8 @@ void ffStrbufInitVF(FFstrbuf* strbuf, const char* format, va_list arguments)
|
||||
{
|
||||
assert(format != NULL);
|
||||
|
||||
#ifndef FF_USE_STBPRINTF
|
||||
int len = vasprintf(&strbuf->chars, format, arguments);
|
||||
assert(len >= 0);
|
||||
#else
|
||||
int len = vsnprintf(NULL, 0, format, arguments);
|
||||
assert(len >= 0);
|
||||
strbuf->chars = (char*) malloc(sizeof(char) * (len + 1));
|
||||
vsnprintf(strbuf->chars, len + 1, format, arguments);
|
||||
#endif
|
||||
|
||||
strbuf->allocated = (uint32_t)(len + 1);
|
||||
strbuf->length = (uint32_t)len;
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
#define FASTFETCH_STRBUF_DEFAULT_ALLOC 32
|
||||
|
||||
#include "stb_printf.h"
|
||||
|
||||
typedef struct FFstrbuf
|
||||
{
|
||||
uint32_t allocated;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#define STB_SPRINTF_IMPLEMENTATION 1
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#include "3rdparty/stb/stb_sprintf.h"
|
||||
@@ -1,50 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FF_USE_STBPRINTF
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "3rdparty/stb/stb_sprintf.h"
|
||||
|
||||
static inline char *STB_SPRINTF_DECORATE(printf_callback)(const char* __restrict buf, void* __restrict user, int len)
|
||||
{
|
||||
fwrite(buf, 1, (uint32_t) len, (FILE *)user);
|
||||
return (char *) buf;
|
||||
}
|
||||
|
||||
static inline int STB_SPRINTF_DECORATE(vfprintf)(FILE* file, char const* __restrict fmt, va_list va)
|
||||
{
|
||||
char tmp[STB_SPRINTF_MIN];
|
||||
return STB_SPRINTF_DECORATE(vsprintfcb)(STB_SPRINTF_DECORATE(printf_callback), file, tmp, fmt, va);
|
||||
}
|
||||
#define vfprintf(...) STB_SPRINTF_DECORATE(vfprintf)(__VA_ARGS__)
|
||||
|
||||
static inline int STBSP__ATTRIBUTE_FORMAT(1,2) STB_SPRINTF_DECORATE(printf)(char const* __restrict fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
int result = STB_SPRINTF_DECORATE(vfprintf)(stdout, fmt, va);
|
||||
va_end(va);
|
||||
return result;
|
||||
}
|
||||
#define printf(...) STB_SPRINTF_DECORATE(printf)(__VA_ARGS__)
|
||||
|
||||
static inline int STBSP__ATTRIBUTE_FORMAT(2,3) STB_SPRINTF_DECORATE(fprintf)(FILE* __restrict file, char const* __restrict fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
int result = STB_SPRINTF_DECORATE(vfprintf)(file, fmt, va);
|
||||
va_end(va);
|
||||
return result;
|
||||
}
|
||||
#define fprintf(...) STB_SPRINTF_DECORATE(fprintf)(__VA_ARGS__)
|
||||
|
||||
#define vsprintf(...) STB_SPRINTF_DECORATE(vsprintf)(__VA_ARGS__)
|
||||
|
||||
#define vsnprintf(...) STB_SPRINTF_DECORATE(vsnprintf)(__VA_ARGS__)
|
||||
|
||||
#define sprintf(...) STB_SPRINTF_DECORATE(sprintf)(__VA_ARGS__)
|
||||
|
||||
#define snprintf(...) STB_SPRINTF_DECORATE(snprintf)(__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user