Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2011-04-12 12:02:46 +0400
committerIgor Sysoev <igor@sysoev.ru>2011-04-12 12:02:46 +0400
commitd63104eea485f72f07c0eed0886890c1090c1f62 (patch)
tree922d1ba70db962fc5f9d6d57066b45bcf95c8104 /src
parentd80bcbcd0fef16a9bf5602fcba5ffa87f5074919 (diff)
use memmove() in appropriate places
Diffstat (limited to 'src')
-rw-r--r--src/core/ngx_conf_file.c2
-rw-r--r--src/core/ngx_string.h4
-rw-r--r--src/http/modules/ngx_http_auth_basic_module.c2
-rw-r--r--src/http/modules/ngx_http_geo_module.c10
-rw-r--r--src/http/modules/ngx_http_ssi_filter_module.c2
-rw-r--r--src/http/ngx_http_core_module.c2
-rw-r--r--src/http/ngx_http_script.c2
7 files changed, 14 insertions, 10 deletions
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 83c107329..689b7e7a2 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -507,7 +507,7 @@ ngx_conf_read_token(ngx_conf_t *cf)
}
if (len) {
- ngx_memcpy(b->start, start, len);
+ ngx_memmove(b->start, start, len);
}
size = (ssize_t) (file_size - cf->conf_file->file.offset);
diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h
index 3f1e91e70..2030988d8 100644
--- a/src/core/ngx_string.h
+++ b/src/core/ngx_string.h
@@ -135,6 +135,10 @@ ngx_copy(u_char *dst, u_char *src, size_t len)
#endif
+#define ngx_memmove(dst, src, n) (void) memmove(dst, src, n)
+#define ngx_movemem(dst, src, n) (((u_char *) memmove(dst, src, n)) + (n))
+
+
/* msvc and icc7 compile memcmp() to the inline loop */
#define ngx_memcmp(s1, s2, n) memcmp((const char *) s1, (const char *) s2, n)
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c
index a6b95fa1d..c6b7f92f1 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -248,7 +248,7 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r)
if (state == sw_passwd) {
left = left + n - passwd;
- ngx_memcpy(buf, &buf[passwd], left);
+ ngx_memmove(buf, &buf[passwd], left);
passwd = 0;
} else {
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index 6ad08b9b2..e60f1f4fb 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -685,7 +685,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
range = a->elts;
- ngx_memcpy(&range[i + 2], &range[i + 1],
+ ngx_memmove(&range[i + 2], &range[i + 1],
(a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t));
range[i + 1].start = (u_short) s;
@@ -724,7 +724,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
range = a->elts;
- ngx_memcpy(&range[i + 3], &range[i + 1],
+ ngx_memmove(&range[i + 3], &range[i + 1],
(a->nelts - 3 - i) * sizeof(ngx_http_geo_range_t));
range[i + 2].start = (u_short) (e + 1);
@@ -752,7 +752,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
range = a->elts;
- ngx_memcpy(&range[i + 1], &range[i],
+ ngx_memmove(&range[i + 1], &range[i],
(a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t));
range[i + 1].start = (u_short) (e + 1);
@@ -776,7 +776,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
range = a->elts;
- ngx_memcpy(&range[i + 2], &range[i + 1],
+ ngx_memmove(&range[i + 2], &range[i + 1],
(a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t));
range[i + 1].start = (u_short) s;
@@ -861,7 +861,7 @@ ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
if (s == (ngx_uint_t) range[i].start
&& e == (ngx_uint_t) range[i].end)
{
- ngx_memcpy(&range[i], &range[i + 1],
+ ngx_memmove(&range[i], &range[i + 1],
(a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t));
a->nelts--;
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index 994efc40c..75a7156ef 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -1902,7 +1902,7 @@ ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx,
len = (uri->data + uri->len) - src;
if (len) {
- dst = ngx_copy(dst, src, len);
+ dst = ngx_movemem(dst, src, len);
}
uri->len = dst - uri->data;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index c8edf9580..06eb0b36c 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1225,7 +1225,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
*e.pos = '\0';
if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
- ngx_memcpy(name, name + alias, len - alias);
+ ngx_memmove(name, name + alias, len - alias);
path.len -= alias;
}
}
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
index ef69155db..8b861ce34 100644
--- a/src/http/ngx_http_script.c
+++ b/src/http/ngx_http_script.c
@@ -1089,7 +1089,7 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e)
NGX_UNESCAPE_REDIRECT);
if (src < e->pos) {
- dst = ngx_copy(dst, src, e->pos - src);
+ dst = ngx_movemem(dst, src, e->pos - src);
}
e->pos = dst;