Re: Re: Convert zval array to char **

From: Date: Fri, 22 Jul 2005 22:27:21 +0000
Subject: Re: Re: Convert zval array to char **
References: 1 2 3  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-2643@lists.php.net to get a copy of this message
> >The char** the function wants is a vector of strings, not a single delimited > >string. Try this out: > > > You would think so wouldn't you. But really what it is looking for is a > 2 element array the first element being a list of values comma > delimeted, and the second being null. > Took me a while to figure that out. ;-) > Well I based that assumption on you saying it was expecting values from argv (which is a vector of strings). So long as it works though. > As for: > > /* This smells a little non-threadsafe, you might want to look a > >little closer */ > > > > > >> if(!strHashValue){ > >> RETURN_FALSE; > >> } > >> > Mmmm... I guess you are loosing me here. I don't suppose someone could > point me in the right direction for some docs on what to look for? > Since this was simply checking if a local to the function variable > exists I did not think there could be any thread issues. > It's a local var, but it's one that's populated by a function which appearanly doesn't require that the string be freed. That suggests to me that it creates the hash in a static buffer. If you have two separate threads generating hashes at the same time (both working within the same static buffer), then one could easily clobber the other. Of course, it's also possible that the char* value returned by the function *is* malloc'd in which case I'd say you're missing a free(). -Sara

« previous php.pecl.dev (#2643) next »