Mercurial > hg > nginx
comparison src/core/ngx_hash.c @ 2049:2a92804f4109
*) back out r2040
*) refactor ngx_palloc()
*) introduce ngx_pnalloc()
*) additional pool blocks have smaller header
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 17 Jun 2008 15:00:30 +0000 |
parents | 22fb8f72d3e7 |
children | 8c6521eedf84 |
comparison
equal
deleted
inserted
replaced
2048:824615f3b4ec | 2049:2a92804f4109 |
---|---|
837 if (name == NULL) { | 837 if (name == NULL) { |
838 return NGX_ERROR; | 838 return NGX_ERROR; |
839 } | 839 } |
840 | 840 |
841 name->len = last - 1; | 841 name->len = last - 1; |
842 name->data = ngx_palloc(ha->temp_pool, name->len); | 842 name->data = ngx_pnalloc(ha->temp_pool, name->len); |
843 if (name->data == NULL) { | 843 if (name->data == NULL) { |
844 return NGX_ERROR; | 844 return NGX_ERROR; |
845 } | 845 } |
846 | 846 |
847 ngx_memcpy(name->data, &key->data[1], name->len); | 847 ngx_memcpy(name->data, &key->data[1], name->len); |
853 /* | 853 /* |
854 * convert "*.example.com" to "com.example.\0" | 854 * convert "*.example.com" to "com.example.\0" |
855 * and ".example.com" to "com.example\0" | 855 * and ".example.com" to "com.example\0" |
856 */ | 856 */ |
857 | 857 |
858 p = ngx_palloc(ha->temp_pool, last); | 858 p = ngx_pnalloc(ha->temp_pool, last); |
859 if (p == NULL) { | 859 if (p == NULL) { |
860 return NGX_ERROR; | 860 return NGX_ERROR; |
861 } | 861 } |
862 | 862 |
863 len = 0; | 863 len = 0; |
889 | 889 |
890 /* convert "www.example.*" to "www.example\0" */ | 890 /* convert "www.example.*" to "www.example\0" */ |
891 | 891 |
892 last++; | 892 last++; |
893 | 893 |
894 p = ngx_palloc(ha->temp_pool, last); | 894 p = ngx_pnalloc(ha->temp_pool, last); |
895 if (p == NULL) { | 895 if (p == NULL) { |
896 return NGX_ERROR; | 896 return NGX_ERROR; |
897 } | 897 } |
898 | 898 |
899 ngx_cpystrn(p, key->data, last); | 899 ngx_cpystrn(p, key->data, last); |
942 if (name == NULL) { | 942 if (name == NULL) { |
943 return NGX_ERROR; | 943 return NGX_ERROR; |
944 } | 944 } |
945 | 945 |
946 name->len = last - skip; | 946 name->len = last - skip; |
947 name->data = ngx_palloc(ha->temp_pool, name->len); | 947 name->data = ngx_pnalloc(ha->temp_pool, name->len); |
948 if (name->data == NULL) { | 948 if (name->data == NULL) { |
949 return NGX_ERROR; | 949 return NGX_ERROR; |
950 } | 950 } |
951 | 951 |
952 ngx_memcpy(name->data, key->data + skip, name->len); | 952 ngx_memcpy(name->data, key->data + skip, name->len); |