comparison src/core/ngx_conf_file.c @ 5330:314c3d7cc3a5

Backed out f1a91825730a and 7094bd12c1ff. While ngx_get_full_name() might have a bit more descriptive arguments, the ngx_conf_full_name() is generally easier to use when parsing configuration and limits exposure of cycle->prefix / cycle->conf_prefix details.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 20 Aug 2013 21:11:19 +0400
parents 7094bd12c1ff
children e04083b79335
comparison
equal deleted inserted replaced
5329:00bdc9f08a16 5330:314c3d7cc3a5
745 value = cf->args->elts; 745 value = cf->args->elts;
746 file = value[1]; 746 file = value[1];
747 747
748 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); 748 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
749 749
750 if (ngx_get_full_name(cf->pool, &cf->cycle->conf_prefix, &file) != NGX_OK) { 750 if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
751 return NGX_CONF_ERROR; 751 return NGX_CONF_ERROR;
752 } 752 }
753 753
754 if (strpbrk((char *) file.data, "*?[") == NULL) { 754 if (strpbrk((char *) file.data, "*?[") == NULL) {
755 755
795 795
796 return rv; 796 return rv;
797 } 797 }
798 798
799 799
800 ngx_int_t
801 ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
802 {
803 return ngx_get_full_name(cycle->pool,
804 conf_prefix ? &cycle->conf_prefix:
805 &cycle->prefix,
806 name);
807 }
808
809
800 ngx_open_file_t * 810 ngx_open_file_t *
801 ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name) 811 ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
802 { 812 {
803 ngx_str_t full; 813 ngx_str_t full;
804 ngx_uint_t i; 814 ngx_uint_t i;
810 #endif 820 #endif
811 821
812 if (name->len) { 822 if (name->len) {
813 full = *name; 823 full = *name;
814 824
815 if (ngx_get_full_name(cycle->pool, &cycle->prefix, &full) != NGX_OK) { 825 if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) {
816 return NULL; 826 return NULL;
817 } 827 }
818 828
819 part = &cycle->open_files.part; 829 part = &cycle->open_files.part;
820 file = part->elts; 830 file = part->elts;