php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40693 reimplementation of strtok_r in TSRM/tsrm_strtok_r.c
Submitted: 2007-03-02 17:22 UTC Modified: 2007-03-02 20:08 UTC
From: stefan dot teleman at gmail dot com Assigned:
Status: Wont fix Package: Strings related
PHP Version: 5.2.1 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stefan dot teleman at gmail dot com
New email:
PHP Version: OS:

 

 [2007-03-02 17:22 UTC] stefan dot teleman at gmail dot com
Description:
------------
TSRM/tsrm_strtok_r.c reimplements strtok_r(3C) (php-5.2.0 and php-5.2.1).

Please don't do this on Solaris. There is no reason to reimplement a Standard C Library function.

diff -wu output included below.



Reproduce code:
---------------
--- tsrm_strtok_r.c.orig        2000-09-11 11:15:29.000000000 -0400
+++ tsrm_strtok_r.c     2007-03-02 03:25:44.953128000 -0500
@@ -16,6 +16,9 @@
 
 char *tsrm_strtok_r(char *s, const char *delim, char **last)
 {
+#if defined(SOLARIS)
+        return strtok_r(s, delim, last);
+#else
        char *token;
 
        if (s == NULL) {
@@ -41,6 +44,7 @@
                *last = s + 1;
        }
        return token;
+#endif
 }
 
 #if 0



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-02 19:58 UTC] helly@php.net
Usually reimplementation of a c library function means that we rely on very specific functionality. Otfen in this cases many implementations are simply plain wrong. This is true for a bunch of stuff where werequire the C99 compliant implementation.
 [2007-03-02 20:08 UTC] stefan dot teleman at gmail dot com
Exactly what features or specific functionality does your strtok_r provide that strtok_r implementations from Solaris or Linux or BSD or Windows do not ?

None.

If you have identified a bug in any of these implementations of strtok_r(3C), please identify the bug.

Duplicating Standard C Library all over the place just because "it doesn't crash anymore if I do this" is not really a valid justification.

Thank you.

Stefan Teleman
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC