struct sf_shared_mbuffer: Must move buff to last

rw_perf_optimization
YuQing 2022-08-30 11:07:31 +08:00
parent 8b22655352
commit a0f16319e0
3 changed files with 1 additions and 3 deletions

View File

@ -620,7 +620,6 @@ int sf_client_sock_read(int sock, short event, void *arg)
task->recv_body = SF_CTX->alloc_recv_buffer(task,
task->length - SF_CTX->header_size, &new_alloc);
if (new_alloc && task->recv_body == NULL) {
logInfo("recv_body is NULL!!!!!!!!!!!!!!!!!");
ioevent_add_to_deleted_list(task);
return -1;
}

View File

@ -21,7 +21,6 @@ static int sf_shared_mbuffer_alloc_init(void *element, void *args)
buffer = (SFSharedMBuffer *)((char *)element +
sizeof(struct fast_allocator_wrapper));
buffer->buff = (char *)(buffer + 1);
buffer->ctx = (SFSharedMBufferContext *)args;
return 0;
}

View File

@ -27,10 +27,10 @@ typedef struct sf_shared_mbuffer_context {
} SFSharedMBufferContext;
typedef struct sf_shared_mbuffer {
char *buff;
int length;
volatile int reffer_count;
SFSharedMBufferContext *ctx;
char buff[0]; //must be last
} SFSharedMBuffer;
#ifdef __cplusplus