comparison src/core/ngx_string.h @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 4b2dafa26fe2
children 45fe5b98a9de
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
20 20
21 #define ngx_string(str) { sizeof(str) - 1, (u_char *) str } 21 #define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
22 #define ngx_null_string { 0, NULL } 22 #define ngx_null_string { 0, NULL }
23 23
24 24
25 #if (WIN32) 25 #if (NGX_WIN32)
26 26
27 #define ngx_strncasecmp(s1, s2, n) \ 27 #define ngx_strncasecmp(s1, s2, n) \
28 strnicmp((const char *) s1, (const char *) s2, n) 28 strnicmp((const char *) s1, (const char *) s2, n)
29 #define ngx_strcasecmp(s1, s2) \ 29 #define ngx_strcasecmp(s1, s2) \
30 stricmp((const char *) s1, (const char *) s2) 30 stricmp((const char *) s1, (const char *) s2)
31
32 #define ngx_snprintf _snprintf
33 #define ngx_vsnprintf _vsnprintf
34 31
35 #else 32 #else
36 33
37 #define ngx_strncasecmp(s1, s2, n) \ 34 #define ngx_strncasecmp(s1, s2, n) \
38 strncasecmp((const char *) s1, (const char *) s2, n) 35 strncasecmp((const char *) s1, (const char *) s2, n)
39 #define ngx_strcasecmp(s1, s2) \ 36 #define ngx_strcasecmp(s1, s2) \
40 strcasecmp((const char *) s1, (const char *) s2) 37 strcasecmp((const char *) s1, (const char *) s2)
41 38
42 #define ngx_snprintf snprintf
43 #define ngx_vsnprintf vsnprintf
44
45 #endif 39 #endif
46 40
47 41
48 #define ngx_strncmp(s1, s2, n) \ 42 #define ngx_strncmp(s1, s2, n) strncmp((const char *) s1, (const char *) s2, n)
49 strncmp((const char *) s1, (const char *) s2, n) 43
50 44
51 /* msvc and icc compile strcmp() to inline loop */ 45 /* msvc and icc compile strcmp() to inline loop */
52 #define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2) 46 #define ngx_strcmp(s1, s2) strcmp((const char *) s1, (const char *) s2)
53 47
48
54 #define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2) 49 #define ngx_strstr(s1, s2) strstr((const char *) s1, (const char *) s2)
55 #define ngx_strlen(s) strlen((const char *) s) 50 #define ngx_strlen(s) strlen((const char *) s)
51
56 52
57 /* 53 /*
58 * msvc and icc compile memset() to the inline "rep stos" 54 * msvc and icc compile memset() to the inline "rep stos"
59 * while ZeroMemory() and bzero() are the calls. 55 * while ZeroMemory() and bzero() are the calls.
60 * icc may also inline several mov's of a zeroed register for small blocks. 56 * icc may also inline several mov's of a zeroed register for small blocks.
61 */ 57 */
62 #define ngx_memzero(buf, n) memset(buf, 0, n) 58 #define ngx_memzero(buf, n) memset(buf, 0, n)
63 #define ngx_memset(buf, c, n) memset(buf, c, n) 59 #define ngx_memset(buf, c, n) memset(buf, c, n)
64 60
61
65 /* msvc and icc compile memcpy() to the inline "rep movs" */ 62 /* msvc and icc compile memcpy() to the inline "rep movs" */
66 #define ngx_memcpy(dst, src, n) memcpy(dst, src, n) 63 #define ngx_memcpy(dst, src, n) memcpy(dst, src, n)
67 #define ngx_cpymem(dst, src, n) ((u_char *) memcpy(dst, src, n)) + n 64 #define ngx_cpymem(dst, src, n) ((u_char *) memcpy(dst, src, n)) + n
68 65
66
69 /* msvc and icc compile memcmp() to the inline loop */ 67 /* msvc and icc compile memcmp() to the inline loop */
70 #define ngx_memcmp memcmp 68 #define ngx_memcmp memcmp
71 69
70
72 u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n); 71 u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n);
73 u_char *ngx_sprintf(u_char *buf, char *fmt, ...); 72 u_char *ngx_sprintf(u_char *buf, const char *fmt, ...);
73 u_char *ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...);
74 u_char *ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args);
74 75
75 ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n); 76 ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n);
76 ngx_int_t ngx_rstrncasecmp(u_char *s1, u_char *s2, size_t n); 77 ngx_int_t ngx_rstrncasecmp(u_char *s1, u_char *s2, size_t n);
77 78
78 ngx_int_t ngx_atoi(u_char *line, size_t n); 79 ngx_int_t ngx_atoi(u_char *line, size_t n);
84 #define ngx_base64_encoded_length(len) (((len + 2) / 3) * 4) 85 #define ngx_base64_encoded_length(len) (((len + 2) / 3) * 4)
85 #define ngx_base64_decoded_length(len) (((len + 3) / 4) * 3) 86 #define ngx_base64_decoded_length(len) (((len + 3) / 4) * 3)
86 87
87 void ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src); 88 void ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src);
88 ngx_int_t ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src); 89 ngx_int_t ngx_decode_base64(ngx_str_t *dst, ngx_str_t *src);
89 ngx_int_t ngx_escape_uri(u_char *dst, u_char *src, size_t size); 90
91
92 #define NGX_ESCAPE_URI 0
93 #define NGX_ESCAPE_HTML 1
94
95 ngx_uint_t ngx_escape_uri(u_char *dst, u_char *src, size_t size,
96 ngx_uint_t type);
90 97
91 98
92 #define ngx_qsort qsort 99 #define ngx_qsort qsort
93 100
94 101