FFstrbuf: adds FF_STRBUF_STATIC

This commit is contained in:
李通洲
2026-08-14 18:27:53 +08:00
parent 51f36fa4b4
commit 858d3749f4
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <assert.h>
#include "common/memrchr.h"
#include "common/arrutil.h"
#ifdef FF_USE_SYSTEM_YYJSON
#include <yyjson.h>
@@ -628,3 +629,4 @@ static inline void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file) {
bool ffStrbufDecodeHexEscapeSequences(FFstrbuf* strbuf);
#define FF_STRBUF_AUTO_DESTROY [[gnu::cleanup(ffStrbufDestroy)]] FFstrbuf
#define FF_STRBUF_STATIC(str) { .allocated = 0, .length = (uint32_t) ARRAY_SIZE(str) - 1, .chars = str }
+2
View File
@@ -23,6 +23,8 @@ int shouldNotBeCalled(int c) {
exit(1);
}
const FFstrbuf testCreateStatic = FF_STRBUF_STATIC("TEST");
int main(void) {
FFstrbuf strbuf;