Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

cvs: ZendEngine2 / zend_constants.c: msg#00042

php.cvs.zend

Subject: cvs: ZendEngine2 / zend_constants.c

andrei Wed May 26 17:01:37 2004 EDT

Modified files:
/ZendEngine2 zend_constants.c
Log:
Avoid unnecessary and silly copying of constant name when registering.


http://cvs.php.net/diff.php/ZendEngine2/zend_constants.c?r1=1.66&r2=1.67&ty=u
Index: ZendEngine2/zend_constants.c
diff -u ZendEngine2/zend_constants.c:1.66 ZendEngine2/zend_constants.c:1.67
--- ZendEngine2/zend_constants.c:1.66 Tue Mar 9 10:37:18 2004
+++ ZendEngine2/zend_constants.c Wed May 26 17:01:37 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: zend_constants.c,v 1.66 2004/03/09 15:37:18 andi Exp $ */
+/* $Id: zend_constants.c,v 1.67 2004/05/26 21:01:37 andrei Exp $ */

#include "zend.h"
#include "zend_constants.h"
@@ -302,7 +302,8 @@

ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
{
- char *lowercase_name;
+ char *lowercase_name = NULL;
+ char *name;
int ret = SUCCESS;

#if 0
@@ -313,21 +314,22 @@
/* keep in mind that c->name_len already contains the '\0' */
lowercase_name = do_alloca(c->name_len);
zend_str_tolower_copy(lowercase_name, c->name, c->name_len - 1);
+ name = lowercase_name;
} else {
- lowercase_name = do_alloca(c->name_len + 1);
- memcpy(lowercase_name, c->name, c->name_len);
- lowercase_name[c->name_len] = '\0';
+ name = c->name;
}

- if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len,
(void *) c, sizeof(zend_constant), NULL)==FAILURE) {
+ if (zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c,
sizeof(zend_constant), NULL)==FAILURE) {
free(c->name);
if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
}
- zend_error(E_NOTICE,"Constant %s already defined",
lowercase_name);
+ zend_error(E_NOTICE,"Constant %s already defined", name);
ret = FAILURE;
}
- free_alloca(lowercase_name);
+ if (lowercase_name) {
+ free_alloca(lowercase_name);
+ }
return ret;
}


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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation