Lines Matching refs:chunk
327 static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk…
974 static size_t php_cli_server_chunk_size(const php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_chunk_size() argument
976 switch (chunk->type) { in php_cli_server_chunk_size()
978 return chunk->data.heap.len; in php_cli_server_chunk_size()
980 return chunk->data.immortal.len; in php_cli_server_chunk_size()
985 static void php_cli_server_chunk_dtor(php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_chunk_dtor() argument
987 switch (chunk->type) { in php_cli_server_chunk_dtor()
989 if (chunk->data.heap.block != chunk) { in php_cli_server_chunk_dtor()
990 pefree(chunk->data.heap.block, 1); in php_cli_server_chunk_dtor()
1000 php_cli_server_chunk *chunk, *next; in php_cli_server_buffer_dtor() local
1001 for (chunk = buffer->first; chunk; chunk = next) { in php_cli_server_buffer_dtor()
1002 next = chunk->next; in php_cli_server_buffer_dtor()
1003 php_cli_server_chunk_dtor(chunk); in php_cli_server_buffer_dtor()
1004 pefree(chunk, 1); in php_cli_server_buffer_dtor()
1014 static void php_cli_server_buffer_append(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk… in php_cli_server_buffer_append() argument
1017 for (last = chunk; last->next; last = last->next); in php_cli_server_buffer_append()
1019 buffer->first = chunk; in php_cli_server_buffer_append()
1021 buffer->last->next = chunk; in php_cli_server_buffer_append()
1026 …php_cli_server_buffer_prepend(php_cli_server_buffer *buffer, php_cli_server_chunk *chunk) /* {{{ */ in php_cli_server_buffer_prepend() argument
1029 for (last = chunk; last->next; last = last->next); in php_cli_server_buffer_prepend()
1034 buffer->first = chunk; in php_cli_server_buffer_prepend()
1039 php_cli_server_chunk *chunk; in php_cli_server_buffer_size() local
1041 for (chunk = buffer->first; chunk; chunk = chunk->next) { in php_cli_server_buffer_size()
1042 retval += php_cli_server_chunk_size(chunk); in php_cli_server_buffer_size()
1049 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk), 1); in php_cli_server_chunk_immortal_new() local
1050 if (!chunk) { in php_cli_server_chunk_immortal_new()
1054 chunk->type = PHP_CLI_SERVER_CHUNK_IMMORTAL; in php_cli_server_chunk_immortal_new()
1055 chunk->next = NULL; in php_cli_server_chunk_immortal_new()
1056 chunk->data.immortal.p = buf; in php_cli_server_chunk_immortal_new()
1057 chunk->data.immortal.len = len; in php_cli_server_chunk_immortal_new()
1058 return chunk; in php_cli_server_chunk_immortal_new()
1063 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk), 1); in php_cli_server_chunk_heap_new() local
1064 if (!chunk) { in php_cli_server_chunk_heap_new()
1068 chunk->type = PHP_CLI_SERVER_CHUNK_HEAP; in php_cli_server_chunk_heap_new()
1069 chunk->next = NULL; in php_cli_server_chunk_heap_new()
1070 chunk->data.heap.block = block; in php_cli_server_chunk_heap_new()
1071 chunk->data.heap.p = buf; in php_cli_server_chunk_heap_new()
1072 chunk->data.heap.len = len; in php_cli_server_chunk_heap_new()
1073 return chunk; in php_cli_server_chunk_heap_new()
1078 php_cli_server_chunk *chunk = pemalloc(sizeof(php_cli_server_chunk) + len, 1); in php_cli_server_chunk_heap_new_self_contained() local
1079 if (!chunk) { in php_cli_server_chunk_heap_new_self_contained()
1083 chunk->type = PHP_CLI_SERVER_CHUNK_HEAP; in php_cli_server_chunk_heap_new_self_contained()
1084 chunk->next = NULL; in php_cli_server_chunk_heap_new_self_contained()
1085 chunk->data.heap.block = chunk; in php_cli_server_chunk_heap_new_self_contained()
1086 chunk->data.heap.p = (char *)(chunk + 1); in php_cli_server_chunk_heap_new_self_contained()
1087 chunk->data.heap.len = len; in php_cli_server_chunk_heap_new_self_contained()
1088 return chunk; in php_cli_server_chunk_heap_new_self_contained()
1103 php_cli_server_chunk *chunk, *next; in php_cli_server_content_sender_send() local
1106 for (chunk = sender->buffer.first; chunk; chunk = next) { in php_cli_server_content_sender_send()
1108 next = chunk->next; in php_cli_server_content_sender_send()
1110 switch (chunk->type) { in php_cli_server_content_sender_send()
1112 nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); in php_cli_server_content_sender_send()
1116 } else if (nbytes_sent == chunk->data.heap.len) { in php_cli_server_content_sender_send()
1117 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_send()
1118 pefree(chunk, 1); in php_cli_server_content_sender_send()
1124 chunk->data.heap.p += nbytes_sent; in php_cli_server_content_sender_send()
1125 chunk->data.heap.len -= nbytes_sent; in php_cli_server_content_sender_send()
1131 nbytes_sent = send(fd, chunk->data.immortal.p, chunk->data.immortal.len, 0); in php_cli_server_content_sender_send()
1135 } else if (nbytes_sent == chunk->data.immortal.len) { in php_cli_server_content_sender_send()
1136 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_send()
1137 pefree(chunk, 1); in php_cli_server_content_sender_send()
1143 chunk->data.immortal.p += nbytes_sent; in php_cli_server_content_sender_send()
1144 chunk->data.immortal.len -= nbytes_sent; in php_cli_server_content_sender_send()
1157 php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(131072); in php_cli_server_content_sender_pull() local
1159 _nbytes_read = read(fd, chunk->data.heap.p, chunk->data.heap.len); in php_cli_server_content_sender_pull()
1165 php_cli_server_chunk_dtor(chunk); in php_cli_server_content_sender_pull()
1166 pefree(chunk, 1); in php_cli_server_content_sender_pull()
1169 chunk->data.heap.len = _nbytes_read; in php_cli_server_content_sender_pull()
1170 php_cli_server_buffer_append(&sender->buffer, chunk); in php_cli_server_content_sender_pull()
1934 …php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_templat… in php_cli_server_send_error_page() local
1935 if (!chunk) { in php_cli_server_send_error_page()
1938 …snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, escap… in php_cli_server_send_error_page()
1939 chunk->data.heap.len = strlen(chunk->data.heap.p); in php_cli_server_send_error_page()
1940 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1943 …php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(php_cli_server_css, sizeof(php_cli… in php_cli_server_send_error_page() local
1944 if (!chunk) { in php_cli_server_send_error_page()
1947 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1951 php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(template, sizeof(template) - 1); in php_cli_server_send_error_page() local
1952 if (!chunk) { in php_cli_server_send_error_page()
1955 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1958 …php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template… in php_cli_server_send_error_page() local
1959 if (!chunk) { in php_cli_server_send_error_page()
1962 …snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, escaped_reques… in php_cli_server_send_error_page()
1963 chunk->data.heap.len = strlen(chunk->data.heap.p); in php_cli_server_send_error_page()
1964 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1968 …php_cli_server_chunk *chunk = php_cli_server_chunk_immortal_new(epilogue_template, sizeof(epilogue… in php_cli_server_send_error_page() local
1969 if (!chunk) { in php_cli_server_send_error_page()
1972 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
1976 php_cli_server_chunk *chunk; in php_cli_server_send_error_page() local
1990 chunk = php_cli_server_chunk_heap_new(buffer.c, buffer.c, buffer.len); in php_cli_server_send_error_page()
1991 if (!chunk) { in php_cli_server_send_error_page()
1995 php_cli_server_buffer_prepend(&client->content_sender.buffer, chunk); in php_cli_server_send_error_page()
2056 php_cli_server_chunk *chunk; in php_cli_server_begin_send_static() local
2080 chunk = php_cli_server_chunk_heap_new(buffer.c, buffer.c, buffer.len); in php_cli_server_begin_send_static()
2081 if (!chunk) { in php_cli_server_begin_send_static()
2086 php_cli_server_buffer_append(&client->content_sender.buffer, chunk); in php_cli_server_begin_send_static()