jani            Tue Nov  6 17:58:53 2007 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       mail.c 
  Log:
  MFH: ws + cs
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.1&r2=1.87.2.1.2.7.2.2&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.1 
php-src/ext/standard/mail.c:1.87.2.1.2.7.2.2
--- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.1        Sun Sep 30 05:49:45 2007
+++ php-src/ext/standard/mail.c Tue Nov  6 17:58:53 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: mail.c,v 1.87.2.1.2.7.2.1 2007/09/30 05:49:45 jani Exp $ */
+/* $Id: mail.c,v 1.87.2.1.2.7.2.2 2007/11/06 17:58:53 jani Exp $ */
 
 #include <stdlib.h>
 #include <ctype.h>
@@ -45,22 +45,21 @@
 #define EX_TEMPFAIL     75      /* temp failure; user is invited to retry */
 #endif
 
-#define SKIP_LONG_HEADER_SEP(str, pos)                                         
                                \
+#define SKIP_LONG_HEADER_SEP(str, pos)                                         
                                                                                
        \
        if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || 
str[pos + 2] == '\t')) {        \
-               pos += 2;                                                       
                                \
-               while (str[pos + 1] == ' ' || str[pos + 1] == '\t') {           
                                        \
-                       pos++;                                                  
                                \
-               }                                                               
                                \
-               continue;                                                       
                                \
-       }                                                                       
                                \
-
-#define MAIL_ASCIIZ_CHECK(str, len)                    \
-       p = str;                                        \
-       e = p + len;                                    \
+               pos += 2;                                                       
                                                                                
                                        \
+               while (str[pos + 1] == ' ' || str[pos + 1] == '\t') {           
                                                                        \
+                       pos++;                                                  
                                                                                
                                        \
+               }                                                               
                                                                                
                                                \
+               continue;                                                       
                                                                                
                                        \
+       }                                                                       
                                                                                
                                                \
+
+#define MAIL_ASCIIZ_CHECK(str, len)                            \
+       p = str;                                                                
        \
+       e = p + len;                                                            
\
        while ((p = memchr(p, '\0', (e - p)))) {        \
-               *p = ' ';                               \
-       }                                               \
-
+               *p = ' ';                                                       
        \
+       }                                                                       
                \
 
 /* {{{ proto int ezmlm_hash(string addr)
    Calculate EZMLM list hash value. */
@@ -69,18 +68,17 @@
        char *str = NULL;
        unsigned long h = 5381L;
        int j, str_len;
-       
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
-                                                         &str, &str_len) == 
FAILURE) {
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, 
&str_len) == FAILURE) {
                return;
        }
 
        for (j = 0; j < str_len; j++) {
                h = (h + (h << 5)) ^ (unsigned long) (unsigned char) 
tolower(str[j]);
        }
-       
+
        h = (h % 53);
-       
+
        RETURN_LONG((int) h);
 }
 /* }}} */
@@ -100,15 +98,11 @@
        if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE 
Restriction in effect.  The fifth parameter is disabled in SAFE MODE");
                RETURN_FALSE;
-       }       
-       
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss",
-                                                         &to, &to_len,
-                                                         &subject, 
&subject_len,
-                                                         &message, 
&message_len,
-                                                         &headers, 
&headers_len,
-                                                         &extra_cmd, 
&extra_cmd_len
-                                                         ) == FAILURE) {
+       }
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss",  &to, 
&to_len, &subject, &subject_len, &message, &message_len,
+                                                                               
                                                        &headers, &headers_len, 
&extra_cmd, &extra_cmd_len) == FAILURE
+       ) {
                return;
        }
 
@@ -136,15 +130,14 @@
                                /* According to RFC 822, section 3.1.1 long 
headers may be separated into
                                 * parts using CRLF followed at least one 
linear-white-space character ('\t' or ' ').
                                 * To prevent these separators from being 
replaced with a space, we use the
-                                * SKIP_LONG_HEADER_SEP to skip over them.
-                                */
+                                * SKIP_LONG_HEADER_SEP to skip over them. */
                                SKIP_LONG_HEADER_SEP(to_r, i);
                                to_r[i] = ' ';
                        }
                }
        } else {
                to_r = to;
-       }
+       }
 
        if (subject_len > 0) {
                subject_r = estrndup(subject, subject_len);
@@ -154,7 +147,7 @@
                        }
                        subject_r[subject_len - 1] = '\0';
                }
-               for(i = 0; subject_r[i]; i++) {
+               for (i = 0; subject_r[i]; i++) {
                        if (iscntrl((unsigned char) subject_r[i])) {
                                SKIP_LONG_HEADER_SEP(subject_r, i);
                                subject_r[i] = ' ';
@@ -233,8 +226,9 @@
        errno = 0;
        sendmail = popen(sendmail_cmd, "w");
 #endif
-       if (extra_cmd != NULL)
+       if (extra_cmd != NULL) {
                efree (sendmail_cmd);
+       }
 
        if (sendmail) {
 #ifndef PHP_WIN32
@@ -251,6 +245,7 @@
                }
                fprintf(sendmail, "\n%s\n", message);
                ret = pclose(sendmail);
+
 #ifdef PHP_WIN32
                if (ret == -1)
 #else

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to