nxt_buf.c (352:47649fbbcb53) nxt_buf.c (430:3a24c399394f)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 45 unchanged lines hidden (view full) ---

54
55
56nxt_buf_t *
57nxt_buf_mem_ts_alloc(nxt_task_t *task, nxt_mp_t *mp, size_t size)
58{
59 nxt_buf_t *b;
60 nxt_buf_ts_t *ts;
61
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 45 unchanged lines hidden (view full) ---

54
55
56nxt_buf_t *
57nxt_buf_mem_ts_alloc(nxt_task_t *task, nxt_mp_t *mp, size_t size)
58{
59 nxt_buf_t *b;
60 nxt_buf_ts_t *ts;
61
62 b = nxt_mp_retain(mp, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t) + size);
62 b = nxt_mp_alloc(mp, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t) + size);
63 if (nxt_slow_path(b == NULL)) {
64 return NULL;
65 }
66
63 if (nxt_slow_path(b == NULL)) {
64 return NULL;
65 }
66
67 nxt_mp_retain(mp);
68
67 nxt_memzero(b, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t));
68
69 b->data = mp;
70 b->completion_handler = nxt_buf_ts_completion;
71 b->is_ts = 1;
72
73 if (size != 0) {
74 b->mem.start = nxt_pointer_to(b, NXT_BUF_MEM_SIZE +

--- 204 unchanged lines hidden (view full) ---

279 if (nxt_slow_path(data != b->parent)) {
280 nxt_log_alert(task->log, "completion data (%p) != b->parent (%p)",
281 data, b->parent);
282 nxt_abort();
283 }
284#endif
285
286 mp = b->data;
69 nxt_memzero(b, NXT_BUF_MEM_SIZE + sizeof(nxt_buf_ts_t));
70
71 b->data = mp;
72 b->completion_handler = nxt_buf_ts_completion;
73 b->is_ts = 1;
74
75 if (size != 0) {
76 b->mem.start = nxt_pointer_to(b, NXT_BUF_MEM_SIZE +

--- 204 unchanged lines hidden (view full) ---

281 if (nxt_slow_path(data != b->parent)) {
282 nxt_log_alert(task->log, "completion data (%p) != b->parent (%p)",
283 data, b->parent);
284 nxt_abort();
285 }
286#endif
287
288 mp = b->data;
287 nxt_mp_release(mp, b);
289 nxt_mp_free(mp, b);
290 nxt_mp_release(mp);
288
289 if (parent != NULL) {
290 nxt_debug(task, "parent retain:%uD", parent->retain);
291
292 parent->retain--;
293
294 if (parent->retain == 0) {
295 parent->mem.pos = parent->mem.free;

--- 35 unchanged lines hidden ---
291
292 if (parent != NULL) {
293 nxt_debug(task, "parent retain:%uD", parent->retain);
294
295 parent->retain--;
296
297 if (parent->retain == 0) {
298 parent->mem.pos = parent->mem.free;

--- 35 unchanged lines hidden ---