comparison src/core/ngx_conf_file.c @ 414:388a842cbbe1

nginx-0.0.10-2004-09-03-19:50:30 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 03 Sep 2004 15:50:30 +0000
parents 199cd29f35a3
children 3c56e834be46
comparison
equal deleted inserted replaced
413:de9d4726e28a 414:388a842cbbe1
570 570
571 571
572 ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name) 572 ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
573 { 573 {
574 ngx_uint_t i; 574 ngx_uint_t i;
575 ngx_list_part_t *part;
575 ngx_open_file_t *file; 576 ngx_open_file_t *file;
576 577
577 if (name) { 578 if (name) {
579 part = &cycle->open_files.part;
580 file = part->elts;
581
582 for (i = 0; /* void */ ; i++) {
583
584 if (i >= part->nelts) {
585 if (part->next == NULL) {
586 break;
587 }
588 part = part->next;
589 file = part->elts;
590 i = 0;
591 }
592
593 #if 0
578 file = cycle->open_files.elts; 594 file = cycle->open_files.elts;
579 for (i = 0; i < cycle->open_files.nelts; i++) { 595 for (i = 0; i < cycle->open_files.nelts; i++) {
596 #endif
580 if (name->len != file[i].name.len) { 597 if (name->len != file[i].name.len) {
581 continue; 598 continue;
582 } 599 }
583 600
584 if (ngx_strcmp(name->data, file[i].name.data) == 0) { 601 if (ngx_strcmp(name->data, file[i].name.data) == 0) {
585 return &file[i]; 602 return &file[i];
586 } 603 }
587 } 604 }
588 } 605 }
589 606
590 if (!(file = ngx_push_array(&cycle->open_files))) { 607 if (!(file = ngx_push_list(&cycle->open_files))) {
591 return NULL; 608 return NULL;
592 } 609 }
593 610
594 file->fd = NGX_INVALID_FILE; 611 file->fd = NGX_INVALID_FILE;
595 612