comparison src/http/ngx_http_core_module.c @ 426:3f88935a02e8

nginx-0.0.10-2004-09-14-23:39:54 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 14 Sep 2004 19:39:54 +0000
parents bd39260a1383
children 694cd6cdb714
comparison
equal deleted inserted replaced
425:bd39260a1383 426:3f88935a02e8
1176 ngx_uint_t i; 1176 ngx_uint_t i;
1177 ngx_str_t *args; 1177 ngx_str_t *args;
1178 ngx_http_type_t *type; 1178 ngx_http_type_t *type;
1179 1179
1180 if (lcf->types == NULL) { 1180 if (lcf->types == NULL) {
1181 ngx_test_null(lcf->types, 1181 lcf->types = ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME
1182 ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME 1182 * sizeof(ngx_array_t));
1183 * sizeof(ngx_array_t)), 1183 if (lcf->types == NULL) {
1184 NGX_CONF_ERROR); 1184 return NGX_CONF_ERROR;
1185 }
1185 1186
1186 for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) { 1187 for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) {
1187 ngx_init_array(lcf->types[i], cf->pool, 5, sizeof(ngx_http_type_t), 1188 if (ngx_array_init(&lcf->types[i], cf->pool, 5,
1188 NGX_CONF_ERROR); 1189 sizeof(ngx_http_type_t)) == NGX_ERROR)
1190 {
1191 return NGX_CONF_ERROR;
1192 }
1189 } 1193 }
1190 } 1194 }
1191 1195
1192 args = (ngx_str_t *) cf->args->elts; 1196 args = (ngx_str_t *) cf->args->elts;
1193 1197
1194 for (i = 1; i < cf->args->nelts; i++) { 1198 for (i = 1; i < cf->args->nelts; i++) {
1195 ngx_http_types_hash_key(key, args[i]); 1199 ngx_http_types_hash_key(key, args[i]);
1196 1200
1197 ngx_test_null(type, ngx_push_array(&lcf->types[key]), NGX_CONF_ERROR); 1201 if (!(type = ngx_array_push(&lcf->types[key]))) {
1202 return NGX_CONF_ERROR;
1203 }
1204
1198 type->exten = args[i]; 1205 type->exten = args[i];
1199 type->type = args[0]; 1206 type->type = args[0];
1200 } 1207 }
1201 1208
1202 return NGX_CONF_OK; 1209 return NGX_CONF_OK;