summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2009-04-05 14:10:49 +0000
committerIlia Alshanetsky <iliaa@php.net>2009-04-05 14:10:49 +0000
commit3100dc31f04ac633914ec07d883697e4d17443a0 (patch)
tree4c8cf265e1561309f510d16365bc666a22b07c63
parentd602767ec5f24c94a213ba13e753878abaece76a (diff)
downloadphp-git-3100dc31f04ac633914ec07d883697e4d17443a0.tar.gz
Define _php_rfc822_len() only when needed
-rw-r--r--ext/imap/php_imap.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 8370799c55..7c9493efd8 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -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)