feat(integrate utable): deps/utable

This commit is contained in:
yangwei
2024-11-25 19:22:19 +08:00
parent cce1155ae3
commit 1199e9d83f
35 changed files with 38191 additions and 232 deletions

33
deps/base64/buffer.c vendored Normal file
View File

@@ -0,0 +1,33 @@
#include <stdlib.h>
#include <ctype.h>
#include "b64.h"
#ifdef b64_USE_CUSTOM_MALLOC
extern void* b64_malloc(size_t);
#endif
#ifdef b64_USE_CUSTOM_REALLOC
extern void* b64_realloc(void*, size_t);
#endif
int b64_buf_malloc(b64_buffer_t * buf)
{
buf->ptr = b64_malloc(B64_BUFFER_SIZE);
if(!buf->ptr) return -1;
buf->bufc = 1;
return 0;
}
int b64_buf_realloc(b64_buffer_t* buf, size_t size)
{
if ((int)size > buf->bufc * B64_BUFFER_SIZE)
{
while ((int)size > buf->bufc * B64_BUFFER_SIZE) buf->bufc++;
buf->ptr = b64_realloc(buf->ptr, B64_BUFFER_SIZE * buf->bufc);
if (!buf->ptr) return -1;
}
return 0;
}