Re: SV: [PHP-DEV] erealloc and the API

2001-05-04 Thread Zeev Suraski
At 20:32 4/5/2001, Johan Ekenberg wrote: >Zeev, > >thanks, that made all the difference! > >I got a suggestion from another PHP-developer that mixing calls to >emalloc() and strcpy() might be a problem. Is this so? Not it's not; A block you get from emalloc() is very much the same as a block yo

Re: SV: [PHP-DEV] erealloc and the API

2001-05-04 Thread Sterling Hughes
On Fri, 4 May 2001, Johan Ekenberg wrote: > Zeev, > > thanks, that made all the difference! > > I got a suggestion from another PHP-developer that mixing calls to > emalloc() and strcpy() might be a problem. Is this so? > No, I've never experienced a problem. -Sterling -- PHP Development Mai

SV: [PHP-DEV] erealloc and the API

2001-05-04 Thread Johan Ekenberg
Zeev, thanks, that made all the difference! I got a suggestion from another PHP-developer that mixing calls to emalloc() and strcpy() might be a problem. Is this so? /Johan > erealloc() (like realloc()) returns a pointer to the > realloc'd string. It > may or may not be the same pointer you s

Re: [PHP-DEV] erealloc and the API

2001-05-04 Thread Zeev Suraski
erealloc() (like realloc()) returns a pointer to the realloc'd string. It may or may not be the same pointer you specifed in the first argument. So, your code should look like: ... tmp_variable = erealloc(tmp_variable, ...); Otherwise, you're going to have both a bug and if it doesn't crash y

[PHP-DEV] erealloc and the API

2001-05-04 Thread Johan Ekenberg
I have a question regarding the API, something that bit me while I was working with the php_imap code: Basically I did this (pseudocode): char init_value[10] = "foobar"; tmp_variable = emalloc(strlen(init_value) + 1); strcpy(tmp_variable, init_value); while(condition) { ereall