#32797 [Opn]: xml_element.c... my_free function doesn't work on GCC 4

From: Date: Thu, 21 Apr 2005 22:10:25 +0000
Subject: #32797 [Opn]: xml_element.c... my_free function doesn't work on GCC 4
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78025@lists.php.net to get a copy of this message
ID: 32797 Updated by: sniper@php.net Reported By: JClawson at tamu dot edu Status: Open Bug Type: Compile Failure Operating System: Fedora Core 2 PHP Version: 5.0.4 New Comment: Works fine with GCC 3. Previous Comments: ------------------------------------------------------------------------ [2005-04-22 00:05:29] JClawson at tamu dot edu Description: ------------ The my_free function macro in ext/xmlrpc/libxmlrpc/xml_element.c is poorly written and results in invalid C code on line 192. Please remove this macro completly from the file and write out the proper code for each case the free() function is called. /home/upgrade-tmp/php5-STABLE-200504211236/ext/xmlrpc/libxmlrpc/xml_element.c: In function 'xml_elem_free_non_recurse': /home/upgrade-tmp/php5-STABLE-200504211236/ext/xmlrpc/libxmlrpc/xml_element.c:192: error: invalid lvalue in assignment /home/upgrade-tmp/php5-STABLE-200504211236/ext/xmlrpc/libxmlrpc/xml_element.c: In function 'xml_elem_entity_escape': /home/upgrade-tmp/php5-STABLE-200504211236/ext/xmlrpc/libxmlrpc/xml_element.c:317: warning: pointer targets in assignment differ in signedness /home/upgrade-tmp/php5-STABLE-200504211236/ext/xmlrpc/libxmlrpc/xml_element.c:332: warning: pointer targets in assignment differ in signedness make: *** [ext/xmlrpc/libxmlrpc/xml_element.lo] Error 1 Reproduce code: --------------- Here is the macro #define my_free(thing) if(thing) {free(thing); thing = 0;} This will not work on 192: my_free((char*)root->name); Expected result: ---------------- Consider changing the call on 192 from: my_free((char*)root->name); to: if(root -> name) { free((char*)root->name); root->name = 0; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32797&edit=1

« previous php.bugs (#78025) next »