Commit e588ef80 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

replace some calls to ngx_copy for ngx_memcpy

parent 04f07211
...@@ -27,6 +27,6 @@ ...@@ -27,6 +27,6 @@
#define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ #define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_
static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.2"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.2");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("c3f6fdd8c1a9d2da63552e9949bf82f430aeb939"); static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("04f0721170654f29ae8d4f0bfb4e718cab61cf1c");
#endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */ #endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */
...@@ -195,7 +195,7 @@ ngx_http_push_stream_publisher_body_handler(ngx_http_request_t *r) ...@@ -195,7 +195,7 @@ ngx_http_push_stream_publisher_body_handler(ngx_http_request_t *r)
} }
ngx_http_push_stream_send_response_channel_info(r, channel); ngx_http_push_stream_send_response_channel_info(r, channel);
ngx_http_finalize_request(r, NGX_HTTP_OK); ngx_http_finalize_request(r, NGX_OK);
return; return;
} }
......
...@@ -155,8 +155,6 @@ ngx_http_push_stream_delete_worker_channel(void) ...@@ -155,8 +155,6 @@ ngx_http_push_stream_delete_worker_channel(void)
ngx_uint_t ngx_uint_t
ngx_http_push_stream_apply_text_template(ngx_str_t **dst_value, ngx_str_t **dst_message, ngx_str_t *text, const ngx_str_t *template, const ngx_str_t *token, ngx_slab_pool_t *shpool, ngx_pool_t *temp_pool) ngx_http_push_stream_apply_text_template(ngx_str_t **dst_value, ngx_str_t **dst_message, ngx_str_t *text, const ngx_str_t *template, const ngx_str_t *token, ngx_slab_pool_t *shpool, ngx_pool_t *temp_pool)
{ {
u_char *last;
if (text != NULL) { if (text != NULL) {
if ((*dst_value = ngx_slab_alloc_locked(shpool, sizeof(ngx_str_t) + text->len + 1)) == NULL) { if ((*dst_value = ngx_slab_alloc_locked(shpool, sizeof(ngx_str_t) + text->len + 1)) == NULL) {
return NGX_ERROR; return NGX_ERROR;
...@@ -164,8 +162,8 @@ ngx_http_push_stream_apply_text_template(ngx_str_t **dst_value, ngx_str_t **dst_ ...@@ -164,8 +162,8 @@ ngx_http_push_stream_apply_text_template(ngx_str_t **dst_value, ngx_str_t **dst_
(*dst_value)->len = text->len; (*dst_value)->len = text->len;
(*dst_value)->data = (u_char *) ((*dst_value) + 1); (*dst_value)->data = (u_char *) ((*dst_value) + 1);
last = ngx_copy((*dst_value)->data, text->data, text->len); ngx_memcpy((*dst_value)->data, text->data, text->len);
*last = '\0'; (*dst_value)->data[(*dst_value)->len] = '\0';
u_char *aux = ngx_http_push_stream_str_replace(template->data, token->data, text->data, 0, temp_pool); u_char *aux = ngx_http_push_stream_str_replace(template->data, token->data, text->data, 0, temp_pool);
if (aux == NULL) { if (aux == NULL) {
...@@ -179,8 +177,8 @@ ngx_http_push_stream_apply_text_template(ngx_str_t **dst_value, ngx_str_t **dst_ ...@@ -179,8 +177,8 @@ ngx_http_push_stream_apply_text_template(ngx_str_t **dst_value, ngx_str_t **dst_
(*dst_message)->len = chunk->len; (*dst_message)->len = chunk->len;
(*dst_message)->data = (u_char *) ((*dst_message) + 1); (*dst_message)->data = (u_char *) ((*dst_message) + 1);
last = ngx_copy((*dst_message)->data, chunk->data, (*dst_message)->len); ngx_memcpy((*dst_message)->data, chunk->data, (*dst_message)->len);
*last = '\0'; (*dst_message)->data[(*dst_message)->len] = '\0';
} }
return NGX_OK; return NGX_OK;
......
...@@ -174,7 +174,6 @@ ngx_http_push_stream_get_channel(ngx_str_t *id, ngx_log_t *log, ngx_http_push_st ...@@ -174,7 +174,6 @@ ngx_http_push_stream_get_channel(ngx_str_t *id, ngx_log_t *log, ngx_http_push_st
ngx_http_push_stream_channel_t *channel; ngx_http_push_stream_channel_t *channel;
ngx_slab_pool_t *shpool = (ngx_slab_pool_t *) ngx_http_push_stream_shm_zone->shm.addr; ngx_slab_pool_t *shpool = (ngx_slab_pool_t *) ngx_http_push_stream_shm_zone->shm.addr;
ngx_flag_t is_broadcast_channel = 0; ngx_flag_t is_broadcast_channel = 0;
u_char *last;
channel = ngx_http_push_stream_find_channel(id, log); channel = ngx_http_push_stream_find_channel(id, log);
if (channel != NULL) { // we found our channel if (channel != NULL) { // we found our channel
...@@ -212,8 +211,8 @@ ngx_http_push_stream_get_channel(ngx_str_t *id, ngx_log_t *log, ngx_http_push_st ...@@ -212,8 +211,8 @@ ngx_http_push_stream_get_channel(ngx_str_t *id, ngx_log_t *log, ngx_http_push_st
} }
channel->id.len = id->len; channel->id.len = id->len;
last = ngx_copy(channel->id.data, id->data, channel->id.len); ngx_memcpy(channel->id.data, id->data, channel->id.len);
*last = '\0'; channel->id.data[channel->id.len] = '\0';
channel->broadcast = is_broadcast_channel; channel->broadcast = is_broadcast_channel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment