mirror of
https://github.com/fluencelabs/redis
synced 2025-04-25 02:22:13 +00:00
add to allocate type_tag
This commit is contained in:
parent
e5a72b8d14
commit
a79de2217e
@ -7,8 +7,7 @@ RUN apt-get update \
|
||||
make \
|
||||
cargo
|
||||
|
||||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-10/wasi-sdk-10.0-linux.tar.gz | tar xz --strip-components=1 -C /
|
||||
RUN cargo install fcli
|
||||
RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk-11.0-linux.tar.gz | tar xz --strip-components=1 -C /
|
||||
|
||||
VOLUME /code
|
||||
WORKDIR /code
|
||||
|
@ -18,7 +18,11 @@ void init() {
|
||||
|
||||
int g_isInited = 0;
|
||||
|
||||
void* allocate(size_t size) {
|
||||
void* allocate(size_t size, size_t _type_tag) {
|
||||
if (size == 0 || size + 1 == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// allocate one more byte for adding the \n symbol that indicated the end of request
|
||||
return zmalloc(size + 1);
|
||||
}
|
||||
@ -75,7 +79,7 @@ void clean_client_buffer(client *c) {
|
||||
}
|
||||
|
||||
char *write_response(client *c, size_t *response_size) {
|
||||
char *response = allocate(c->bufpos + c->reply_bytes);
|
||||
char *response = allocate(c->bufpos + c->reply_bytes, 1);
|
||||
*response_size = 0;
|
||||
|
||||
memcpy(response, c->buf, c->bufpos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user