Sascha Schumann wrote: > Here is a patch which aims at reducing the redundant code in > pgsql.c (-685, +211 lines). > > http://apache.org/~sascha/pgsql.diff > > It also significantly reduces the number of memcpy's, > sprintf's and so on and immensily improves readability of the > affected parts of the code. > > Comments are welcome .. I have not yet run it through a > compiler, so YMMV.
Patch itself seems good. (smart_str_* is useful. It calls many realloc vs. a few malloc, though :) Patch applied to current CVS source w/o warnings, but it seems something is missing/wrong. [yohgaki@dev DEV]$ LANG=C make /bin/sh /home/yohgaki/cvs/php/DEV/libtool --mode=compile gcc -Iext/pgsql/ -I/home/yohgaki/cvs/php/DEV/ext/pgsql/ -DPHP_ATOM_INC -I/home/yohgaki/cvs/php/DEV/include -I/home/yohgaki/cvs/php/DEV/main -I/home/yohgaki/cvs/php/DEV -I/usr/include/apache -I/home/yohgaki/cvs/php/DEV/Zend -I/usr/local/include -I/usr/include/libxml2 -I/usr/include/freetype2/freetype -I/usr/local/pgsql/include -I/usr/include/ucd-snmp -DLINUX=22 -DMOD_SSL=208106 -DUSE_HSREGEX -DEAPI -DUSE_EXPAT -I/home/yohgaki/cvs/php/DEV/TSRM -g -Wall -prefer-pic -c /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c -o ext/pgsql/pgsql.lo gcc -Iext/pgsql/ -I/home/yohgaki/cvs/php/DEV/ext/pgsql/ -DPHP_ATOM_INC -I/home/yohgaki/cvs/php/DEV/include -I/home/yohgaki/cvs/php/DEV/main -I/home/yohgaki/cvs/php/DEV -I/usr/include/apache -I/home/yohgaki/cvs/php/DEV/Zend -I/usr/local/include -I/usr/include/libxml2 -I/usr/include/freetype2/freetype -I/usr/local/pgsql/include -I/usr/include/ucd-snmp -DLINUX=22 -DMOD_SSL=208106 -DUSE_HSREGEX -DEAPI -DUSE_EXPAT -I/home/yohgaki/cvs/php/DEV/TSRM -g -Wall -c /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c -fPIC -DPIC -o ext/pgsql/pgsql.lo /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c: In function `get_field_name': /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1076: warning: passing arg 2 of `smart_str_append_unsigned_ex' makes integer from pointer without a cast /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c: In function `zif_pg_last_oid': /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1511: `str' undeclared (first use in this function) /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1511: (Each undeclared identifier is reported only once /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1511: for each function it appears in.) /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1494: warning: unused variable `oid_str' /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c: In function `zif_pg_lo_create': /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1656: `str' undeclared (first use in this function) /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:1618: warning: unused variable `oid_str' /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c: In function `zif_pg_lo_import': /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:2041: `str' undeclared (first use in this function) /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:2002: warning: unused variable `oid_str' /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c: In function `build_assignment_string': /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:4048: `val' undeclared (first use in this function) /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:4060: case label not within a switch statement /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:4063: case label not within a switch statement /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:4066: case label not within a switch statement /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:4069: default label not within a switch statement /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c: In function `php_pgsql_update': /home/yohgaki/cvs/php/DEV/ext/pgsql/pgsql.c:4086: warning: unused variable `val' make: *** [ext/pgsql/pgsql.lo] Error 1 [yohgaki@dev DEV]$ -- Yasuo Ohgaki -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php