comparison src/core/ngx_string.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 4989c3d25945
children 0d75d65c642f
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
32 u_char * 32 u_char *
33 ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src) 33 ngx_pstrdup(ngx_pool_t *pool, ngx_str_t *src)
34 { 34 {
35 u_char *dst; 35 u_char *dst;
36 36
37 if (!(dst = ngx_palloc(pool, src->len))) { 37 dst = ngx_palloc(pool, src->len);
38 if (dst == NULL) {
38 return NULL; 39 return NULL;
39 } 40 }
40 41
41 ngx_memcpy(dst, src->data, src->len); 42 ngx_memcpy(dst, src->data, src->len);
42 43
487 return value; 488 return value;
488 } 489 }
489 } 490 }
490 491
491 492
493 ssize_t
494 ngx_atosz(u_char *line, size_t n)
495 {
496 ssize_t value;
497
498 if (n == 0) {
499 return NGX_ERROR;
500 }
501
502 for (value = 0; n--; line++) {
503 if (*line < '0' || *line > '9') {
504 return NGX_ERROR;
505 }
506
507 value = value * 10 + (*line - '0');
508 }
509
510 if (value < 0) {
511 return NGX_ERROR;
512
513 } else {
514 return value;
515 }
516 }
517
518
519 off_t
520 ngx_atoof(u_char *line, size_t n)
521 {
522 off_t value;
523
524 if (n == 0) {
525 return NGX_ERROR;
526 }
527
528 for (value = 0; n--; line++) {
529 if (*line < '0' || *line > '9') {
530 return NGX_ERROR;
531 }
532
533 value = value * 10 + (*line - '0');
534 }
535
536 if (value < 0) {
537 return NGX_ERROR;
538
539 } else {
540 return value;
541 }
542 }
543
544
545 time_t
546 ngx_atotm(u_char *line, size_t n)
547 {
548 time_t value;
549
550 if (n == 0) {
551 return NGX_ERROR;
552 }
553
554 for (value = 0; n--; line++) {
555 if (*line < '0' || *line > '9') {
556 return NGX_ERROR;
557 }
558
559 value = value * 10 + (*line - '0');
560 }
561
562 if (value < 0) {
563 return NGX_ERROR;
564
565 } else {
566 return value;
567 }
568 }
569
570
492 ngx_int_t 571 ngx_int_t
493 ngx_hextoi(u_char *line, size_t n) 572 ngx_hextoi(u_char *line, size_t n)
494 { 573 {
495 u_char ch; 574 u_char ch;
496 ngx_int_t value; 575 ngx_int_t value;