Re: [PATCH] Getopt with longopts and windows support - part 2
| From: | Jani Taskinen | Date: | Tue, 07 Aug 2007 16:13:27 +0000 |
| Subject: | Re: [PATCH] Getopt with longopts and windows support - part 2 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31478@lists.php.net to get a copy of this message | ||
Thread safe for CGI and CLI ? :)
Or do you find the function useful outside those SAPIs?
--Jani
Johannes Schlüter kirjoitti:
David, On Mon, 2007-08-06 at 09:57 -0400, David Soria Parra wrote:Hi internals, so based on a discussion of php.pecl we thought about using the php_getopt for the PHP_FUNCTION(getopt) instead of the system provided getopt. Here is the patch for that. Hopefully someone is reviewing and commiting the patch as i don't have karma.The idea is good imo, but there are a few things we have to do: - We need more tests, as far as I saw using grep we just have a single testcase for getopt() which is certainly not enough when replacing the implementation. - The current implementation is not thread-safe, I don't know about the glibc implementation but if we use our own implementation for PHP's getopt function that should be threadsafe. - If you move php_getopt to main you have to mark it as PHPAPI so the SAPIs can use it. Maybe there's more, didn't do a deeper review of the patch, yet, since I'd like to wait a) until Jani moved the files and b) we have more tests :-) johannes