comparison src/core/ngx_string.c @ 783:47e2296f9897

decrease number of branches
author Igor Sysoev <igor@sysoev.ru>
date Mon, 16 Oct 2006 12:21:17 +0000
parents 400711951595
children f9b9b84a8e18
comparison
equal deleted inserted replaced
782:37d600dbe9f6 783:47e2296f9897
591 591
592 592
593 ngx_int_t 593 ngx_int_t
594 ngx_hextoi(u_char *line, size_t n) 594 ngx_hextoi(u_char *line, size_t n)
595 { 595 {
596 u_char ch; 596 u_char c, ch;
597 ngx_int_t value; 597 ngx_int_t value;
598 598
599 if (n == 0) { 599 if (n == 0) {
600 return NGX_ERROR; 600 return NGX_ERROR;
601 } 601 }
606 if (ch >= '0' && ch <= '9') { 606 if (ch >= '0' && ch <= '9') {
607 value = value * 16 + (ch - '0'); 607 value = value * 16 + (ch - '0');
608 continue; 608 continue;
609 } 609 }
610 610
611 if (ch >= 'A' && ch <= 'F') { 611 c = (u_char) (ch | 0x20);
612 value = value * 16 + (ch - 'A' + 10); 612
613 continue; 613 if (c >= 'a' && c <= 'f') {
614 } 614 value = value * 16 + (c - 'a' + 10);
615
616 if (ch >= 'a' && ch <= 'f') {
617 value = value * 16 + (ch - 'a' + 10);
618 continue; 615 continue;
619 } 616 }
620 617
621 return NGX_ERROR; 618 return NGX_ERROR;
622 } 619 }