comparison src/core/nginx.c @ 3516:dd1570b6f237

ngx_str_set() and ngx_str_null()
author Igor Sysoev <igor@sysoev.ru>
date Fri, 14 May 2010 09:56:37 +0000
parents f4957081d935
children ffbdaa3c70d6
comparison
equal deleted inserted replaced
3515:76d252724db5 3516:dd1570b6f237
857 cycle->prefix.data = p; 857 cycle->prefix.data = p;
858 858
859 #else 859 #else
860 860
861 #ifdef NGX_CONF_PREFIX 861 #ifdef NGX_CONF_PREFIX
862 cycle->conf_prefix.len = sizeof(NGX_CONF_PREFIX) - 1; 862 ngx_str_set(&cycle->conf_prefix, NGX_CONF_PREFIX);
863 cycle->conf_prefix.data = (u_char *) NGX_CONF_PREFIX;
864 #else 863 #else
865 cycle->conf_prefix.len = sizeof(NGX_PREFIX) - 1; 864 ngx_str_set(&cycle->conf_prefix, NGX_PREFIX);
866 cycle->conf_prefix.data = (u_char *) NGX_PREFIX; 865 #endif
867 #endif 866 ngx_str_set(&cycle->prefix, NGX_PREFIX);
868 cycle->prefix.len = sizeof(NGX_PREFIX) - 1;
869 cycle->prefix.data = (u_char *) NGX_PREFIX;
870 867
871 #endif 868 #endif
872 } 869 }
873 870
874 if (ngx_conf_file) { 871 if (ngx_conf_file) {
875 cycle->conf_file.len = ngx_strlen(ngx_conf_file); 872 cycle->conf_file.len = ngx_strlen(ngx_conf_file);
876 cycle->conf_file.data = ngx_conf_file; 873 cycle->conf_file.data = ngx_conf_file;
877 874
878 } else { 875 } else {
879 cycle->conf_file.len = sizeof(NGX_CONF_PATH) - 1; 876 ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
880 cycle->conf_file.data = (u_char *) NGX_CONF_PATH;
881 } 877 }
882 878
883 if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) { 879 if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
884 return NGX_ERROR; 880 return NGX_ERROR;
885 } 881 }
991 987
992 #endif 988 #endif
993 989
994 990
995 if (ccf->pid.len == 0) { 991 if (ccf->pid.len == 0) {
996 ccf->pid.len = sizeof(NGX_PID_PATH) - 1; 992 ngx_str_set(&ccf->pid, NGX_PID_PATH);
997 ccf->pid.data = (u_char *) NGX_PID_PATH;
998 } 993 }
999 994
1000 if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) { 995 if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
1001 return NGX_CONF_ERROR; 996 return NGX_CONF_ERROR;
1002 } 997 }
1040 ccf->group = grp->gr_gid; 1035 ccf->group = grp->gr_gid;
1041 } 1036 }
1042 1037
1043 1038
1044 if (ccf->lock_file.len == 0) { 1039 if (ccf->lock_file.len == 0) {
1045 ccf->lock_file.len = sizeof(NGX_LOCK_PATH) - 1; 1040 ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH);
1046 ccf->lock_file.data = (u_char *) NGX_LOCK_PATH;
1047 } 1041 }
1048 1042
1049 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) { 1043 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
1050 return NGX_CONF_ERROR; 1044 return NGX_CONF_ERROR;
1051 } 1045 }