Re: [PHP-DEV] concatenating strings
Look at add_string_to_string(). At 04:14 24-08-01, Peter Bowen wrote: I am writing an extension, and trying to figure out how to append to an existing string. I have a pointer to a zval that is a string, and a pointer to another string, along with the other string's length. I have looked for a ZEND_STRCAT macro, or something similar, but don't see anything. What is the proper/best way to handle this? Thanks. Peter -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Zeev Suraski [EMAIL PROTECTED] CTO co-founder, Zend Technologies Ltd. http://www.zend.com/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] concatenating strings
On 25 Aug 2001 00:18:10 +0300, Zeev Suraski wrote: At 00:06 25-08-01, Peter Bowen wrote: I am getting a SIGSEGV with this function. I am probably just missing something. I was hoping for a function with the prototype (snip) What am I missing? Nothing I can see off hand. Where is it crashing? BTW, apparently add_string_to_string() will crash if the first string is empty (in the places it's being used in right now, the first string cannot be empty so this case is not checked). Any chance your first string is empty? Zeev Why yes, actually it is always going to be empty at least once. It is used inside of a loop, and just before the loop starts, the string is empty. The only way the string gets data is through add_string_to_string. Thanks. Peter -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] concatenating strings
I am getting a SIGSEGV with this function. I am probably just missing something. I was hoping for a function with the prototype strcatl(zval **z, char *s, int l); strcat(zval **z, char *s); Lacking those, I tried zval **data; /* call to zend_hash_find to set data */ zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRINGL(tmp, s, l, 1); add_string_to_string(*data, *data, tmp); What am I missing? Thanks. Peter On 24 Aug 2001 11:02:51 +0300, Zeev Suraski wrote: Look at add_string_to_string(). At 04:14 24-08-01, Peter Bowen wrote: I am writing an extension, and trying to figure out how to append to an existing string. I have a pointer to a zval that is a string, and a pointer to another string, along with the other string's length. I have looked for a ZEND_STRCAT macro, or something similar, but don't see anything. What is the proper/best way to handle this? Thanks. Peter -- Zeev Suraski [EMAIL PROTECTED] CTO co-founder, Zend Technologies Ltd. http://www.zend.com/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] concatenating strings
On 25 Aug 2001 00:32:59 +0300, Zeev Suraski wrote: Ok, I can improve add_string_to_string() to support empty strings. Zeev I have managed to avoid the problem, now that I know that I can't have an empty string as the first op, so it works. Once I release the extension, I am sure that people will find ways optimize it, and having an add_string_to_string with will accept a null string will be one of them. Thanks. Peter -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] concatenating strings
At 00:06 25-08-01, Peter Bowen wrote: I am getting a SIGSEGV with this function. I am probably just missing something. I was hoping for a function with the prototype strcatl(zval **z, char *s, int l); strcat(zval **z, char *s); Lacking those, I tried zval **data; /* call to zend_hash_find to set data */ zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_STRINGL(tmp, s, l, 1); add_string_to_string(*data, *data, tmp); What am I missing? Nothing I can see off hand. Where is it crashing? BTW, apparently add_string_to_string() will crash if the first string is empty (in the places it's being used in right now, the first string cannot be empty so this case is not checked). Any chance your first string is empty? Zeev -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] concatenating strings
I am writing an extension, and trying to figure out how to append to an existing string. I have a pointer to a zval that is a string, and a pointer to another string, along with the other string's length. I have looked for a ZEND_STRCAT macro, or something similar, but don't see anything. What is the proper/best way to handle this? Thanks. Peter -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]