]> granicus.if.org Git - php/commitdiff
Define _php_rfc822_len() only when needed
authorIlia Alshanetsky <iliaa@php.net>
Sun, 5 Apr 2009 14:10:49 +0000 (14:10 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 5 Apr 2009 14:10:49 +0000 (14:10 +0000)
ext/imap/php_imap.c

index 8370799c55a3b034f5a73af707f8fec0058b9f3a..7c9493efd8324e6ea6dcfa9521da5c5760a40c5e 100644 (file)
@@ -3886,38 +3886,11 @@ PHP_FUNCTION(imap_mime_header_decode)
 }
 /* }}} */
 
-/* {{{ _php_rfc822_len
- * Calculate string length based on imap's rfc822_cat function.
- */    
-static int _php_rfc822_len(char *str)
-{
-       int len;
-       char *p;
-
-       if (!str || !*str) {
-               return 0;
-       }
-
-       /* strings with special characters will need to be quoted, as a safety measure we
-        * add 2 bytes for the quotes just in case.
-        */
-       len = strlen(str) + 2;
-       p = str;
-       /* rfc822_cat() will escape all " and \ characters, therefor we need to increase
-        * our buffer length to account for these characters.
-        */
-       while ((p = strpbrk(p, "\\\""))) {
-               p++;
-               len++;
-       }
-
-       return len;
-}
-/* }}} */
 
 /* Support Functions */
 
 #ifdef HAVE_RFC822_OUTPUT_ADDRESS_LIST
+
 /* {{{ _php_rfc822_soutr
  */
 static long _php_rfc822_soutr (void *stream, char *string)
@@ -3953,6 +3926,36 @@ static char* _php_rfc822_write_address(ADDRESS *addresslist TSRMLS_DC)
 
 #else
 
+/* {{{ _php_rfc822_len
+ * Calculate string length based on imap's rfc822_cat function.
+ */    
+static int _php_rfc822_len(char *str)
+{
+       int len;
+       char *p;
+
+       if (!str || !*str) {
+               return 0;
+       }
+
+       /* strings with special characters will need to be quoted, as a safety measure we
+        * add 2 bytes for the quotes just in case.
+        */
+       len = strlen(str) + 2;
+       p = str;
+       /* rfc822_cat() will escape all " and \ characters, therefor we need to increase
+        * our buffer length to account for these characters.
+        */
+       while ((p = strpbrk(p, "\\\""))) {
+               p++;
+               len++;
+       }
+
+       return len;
+}
+/* }}} */
+
+
 /* {{{ _php_imap_get_address_size
  */
 static int _php_imap_address_size (ADDRESS *addresslist)