implemented buffer_size calculation in vsprintf_malloc
This commit is contained in:
@@ -47,7 +47,7 @@ typedef struct Result_ {
|
||||
#define IGNORE_RESULT Result_ __ignored_##__LINE__ ATTRIBUTE_UNUSED =
|
||||
|
||||
#define RESULT_ERROR(MSG, IS_MSG_ON_HEAP) (Result_){ .error = Error_create(MSG, IS_MSG_ON_HEAP, ErrorCallPos_here()) }
|
||||
#define RESULT_ERROR_FMT(FORMAT, ARGS...) RESULT_ERROR(sprintf_malloc(4096, FORMAT ,##ARGS), true)
|
||||
#define RESULT_ERROR_FMT(FORMAT, ARGS...) RESULT_ERROR(sprintf_malloc(FORMAT ,##ARGS), true)
|
||||
#define RESULT_ERROR_ERRNO() RESULT_ERROR(strerror(errno), false)
|
||||
#define RESULT_VOID (Result_){ .error = NULL, .u = 0 }
|
||||
#define RESULT_VALUE(FIELD, V) (Result_){ .error = NULL, .FIELD = V }
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "../std.h"
|
||||
|
||||
#define strcat_malloc(STR0, ...) _strcat_malloc(count_args(__VA_ARGS__), STR0, __VA_ARGS__)
|
||||
char* _strcat_malloc(size_t n, cstr str0, ...);
|
||||
char* _vstrcat_malloc(size_t n, cstr str0, va_list argv);
|
||||
char* _strcat_malloc(u64 n, cstr str0, ...);
|
||||
char* _vstrcat_malloc(u64 n, cstr str0, va_list args);
|
||||
|
||||
char* NULLABLE(sprintf_malloc)(size_t buffer_size, cstr format, ...) ATTRIBUTE_CHECK_FORMAT_PRINTF(2, 3);
|
||||
char* NULLABLE(vsprintf_malloc)(size_t buffer_size, cstr format, va_list argv);
|
||||
char* sprintf_malloc(cstr format, ...) ATTRIBUTE_CHECK_FORMAT_PRINTF(1, 2);
|
||||
char* vsprintf_malloc(cstr format, va_list args);
|
||||
|
||||
Reference in New Issue
Block a user