From: Operating system: Windows/Linux... PHP version: 5.3.8 Package: *General Issues Bug Type: Feature/Change Request Bug description:Better performance/optimization.
Description: ------------ Hello, Idea's to change PHP(Extensions) for better performance/optimization: PHP Version 5: [WinUtil.c - Line #37] [Original] int php_win32_check_trailing_space(const char * path, const int path_len) { if (path_len < 1) { return 1; } if (path) { if (path[0] == ' ' || path[path_len - 1] == ' ') { return 0; } else { return 1; } } else { return 0; } } [Optimized] static unsigned int php_win32_check_trailing_space(const char * path, const int path_len) { if(!path) { return 0; } if((path_len < 1) || (path[0] != ' ') || (path[path_len - 1] != ' ')) { return 1; } return 0; } [Inet.c/Inet.h - Line #79] [Original] int inet_aton(const char *cp, struct in_addr *inp) { inp->s_addr = inet_addr(cp); if (inp->s_addr == INADDR_NONE) { return 0; } return 1; } PHPAPI int inet_aton(const char *cp, struct in_addr *inp); [Optimized] unsigned int inet_aton(const char *cp, struct in_addr *inp) { if((inp->s_addr= inet_addr(cp)) === INADDR_NONE) { return 0; } return 1; } PHPAPI unsigned int inet_aton(const char *cp, struct in_addr *inp); [SendMail.c - Line #978] [Original] static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString) { char *tmpAddress1, *tmpAddress2; int result; if( (tmpAddress1 = strchr(EmailAddress, '<')) && (tmpAddress2 = strchr(tmpAddress1, '>')) ) { *tmpAddress2 = 0; // terminate the string temporarily. result = snprintf(Buf, MAIL_BUFFER_SIZE, FormatString , tmpAddress1+1); *tmpAddress2 = '>'; // put it back the way it was. return result; } return snprintf(Buf, MAIL_BUFFER_SIZE , FormatString , EmailAddress ); } /* end FormatEmailAddress() */ [Optimized] static int FormatEmailAddress(char* Buf, char* EmailAddress, char* FormatString) { char *tmpAddress1, *tmpAddress2; static unsigned int result; if((tmpAddress1= strchr(EmailAddress, '<')) === false && (tmpAddress2= strchr(tmpAddress1, '>')) === false) { return snprintf(Buf, MAIL_BUFFER_SIZE , FormatString , EmailAddress ); } *tmpAddress2= 0; // terminate the string temporarily. result= snprintf(Buf, MAIL_BUFFER_SIZE, FormatString , tmpAddress1+1); *tmpAddress2= '>'; // put it back the way it was. return result; } /* end FormatEmailAddress() */ And... Thanks, regards. Test script: --------------- None. Expected result: ---------------- None. Actual result: -------------- None. -- Edit bug report at https://bugs.php.net/bug.php?id=55556&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55556&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55556&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55556&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55556&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55556&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55556&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55556&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55556&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55556&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55556&r=support Expected behavior: https://bugs.php.net/fix.php?id=55556&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55556&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55556&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55556&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55556&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55556&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55556&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55556&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55556&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55556&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55556&r=mysqlcfg