Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87913 invoked by uid 1010); 23 Jul 2006 03:45:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87898 invoked from network); 23 Jul 2006 03:45:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jul 2006 03:45:33 -0000 X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.142.136.132 msa2-mx.centurytel.net Linux 2.4/2.6 Received: from ([209.142.136.132:49259] helo=msa2-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 6E/60-04178-BD0F2C44 for ; Sat, 22 Jul 2006 23:45:32 -0400 Received: from pc1 (ppp1096.lr.centurytel.net [64.91.12.199]) by msa2-mx.centurytel.net (8.13.6/8.13.6) with SMTP id k6N3jQoL003910; Sat, 22 Jul 2006 22:45:26 -0500 Message-ID: <002901c6ae0a$70316870$0201a8c0@pc1> To: , References: <014e01c6acbe$680b1bc0$0201a8c0@pc1> <10845a340607210543lfe173abq2221a1c833c5d9e1@mail.gmail.com> <017701c6acc6$3a526be0$0201a8c0@pc1> <00d401c6ad61$9d235810$0201a8c0@pc1> <10845a340607221404u4f515bb9w914d4a61f9345f28@mail.gmail.com> <10845a340607221454h1c8923bcg9ca534b21853bd86@mail.gmail.com> Date: Sat, 22 Jul 2006 22:45:27 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Subject: Optimizing add_assoc_* with static keys (WAS: Re: [PHP-DEV] [PATCH] array_combine is not binary-key safe) From: php_lists@realplain.com ("Matt W") Hi Richard, Replacement script made it pretty simple I guess. :-) But sizeof("key")+1 should just be sizeof("key") (which == strlen("key")+1). Are there any uses of add_u_assoc_* with hard-coded keys? These changes make things look a little messy, you think? The string is in 2 places, etc... (Maybe why it wasn't done in the first place?) Seems like that ZEND_STRS() macro you mentioned would work well. Or maybe cleanest would be some new add_static_assoc_* macros (and _u versions if needed), or some other naming convention, that uses sizeof() instead of strlen()+1. What do the main devs think? Matt ----- Original Message ----- From: "Richard Quadling" Sent: Saturday, July 22, 2006 > Hi. Sorry about the delay. Had a blonde moment. > > I've used a small script to process the CVS. There are 420 changes!!! > > I've used the following regexps for a search/replace ... > > $s_search = '`add_assoc_(bool|double|long|null|resource|rt_stringl|rt_string|stringl|str ing|unicodel|unicode|zval)*\(([^,]*), > "(.*?)",`i'; > $s_replace = 'add_assoc_$1_ex($2, "$3", sizeof("$3")+1,'; > > Everything SEEMS to look ok. Until I've got MS VC Express Edition > compiling ok, this patch is UNTESTED!! (Sorry about that). > > Files changed. > > php-src/ext/bz2/bz2.c > php-src/ext/calendar/calendar.c > php-src/ext/curl/multi.c > php-src/ext/curl/streams.c > php-src/ext/date/php_date.c > php-src/ext/dbase/dbase.c > php-src/ext/exif/exif.c > php-src/ext/fbsql/php_fbsql.c > php-src/ext/fdf/fdf.c > php-src/ext/gd/gd.c > php-src/ext/gmp/gmp.c > php-src/ext/hwapi/hwapi.cpp > php-src/ext/iconv/iconv.c > php-src/ext/interbase/ibase_blobs.c > php-src/ext/interbase/ibase_query.c > php-src/ext/interbase/ibase_service.c > php-src/ext/ldap/ldap.c > php-src/ext/mbstring/mbstring.c > php-src/ext/oci8/oci8_interface.c > php-src/ext/openssl/openssl.c > php-src/ext/pdo/pdo_stmt.c > php-src/ext/pdo_mysql/mysql_statement.c > php-src/ext/pdo_pgsql/pgsql_statement.c > php-src/ext/pdo_sqlite/sqlite_statement.c > php-src/ext/pgsql/pgsql.c > php-src/ext/posix/posix.c > php-src/ext/session/session.c > php-src/ext/soap/php_http.c > php-src/ext/sockets/sockets.c > php-src/ext/standard/basic_functions.c > php-src/ext/standard/datetime.c > php-src/ext/standard/dns.c > php-src/ext/standard/file.c > php-src/ext/standard/html.c > php-src/ext/standard/image.c > php-src/ext/standard/microtime.c > php-src/ext/standard/proc_open.c > php-src/ext/standard/streamsfuncs.c > php-src/ext/standard/string.c > php-src/ext/standard/url.c > php-src/ext/sysvmsg/sysvmsg.c > php-src/main/output.c > php-src/main/streams/filter.c > php-src/main/streams/memory.c > php-src/main/streams/xp_socket.c > > > Patch is available at > http://rquadling.phpnet.us/add_assoc_xxx__to__add_assoc_xxx_ex__diff.txt > > Regards, > > Richard Quadling.