On Mon, 14 Jun 2004 11:00:33 +0200 (CEST), Derick Rethans <[EMAIL PROTECTED]> wrote:

if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &p, &nr) ==
FAILURE) {
return;
}
/* !!! there is no error check nr < 0 */

Of course not, that's pointless as a string can never have a negative length.


:) Are you sure? I'm not. Look on declaration of [nr] variable: int nr; And answer, please, which value will be assigned to nr, if length of a string will be greater than 0x7fffffff on 32-bit architecture?

len = 0 ; /* !!! remove it! */

Why? It's used one line below and you HAVE to initalize a variable.


I can't find any sense of the [len] variable. Can you?

Below is corrected function with speed improvement in main cycle

It also violates our coding standards BIG time.

It is only idle talk. Can you provide any string from my code which violates your "coding standards"?

By the way, your "coding standards" violates C standards on type
of string (and any other byte arrays) length. Why are you use int
instead of size_t?:
typedef union _zvalue_value {
    long lval;                  /* long value */
    double dval;                /* double value */
    struct {
        char *val;
        int len; /* !!!!!!!!!!!!! why int, not size_t ????? */
    } str;
    HashTable *ht;              /* hash table value */
    zend_object obj;
} zvalue_value;


And there is no reason to expand that macro at all

Is significant speed improvement silly reason for you?


-- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to