Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7bfcd92b03f140c91dcc04e9a4d5b1abee26bee8
Ticket: 1902648fffffffffffffffffffffffffffffffff
Do not use strcasecmp
User & Date: jenglish on 2008-02-27 09:53:46
Changes

  1. icomment:
    
    
    File Deleted - 268199: 
    
    Logged In: YES 
    user_id=68433
    Originator: YES
    
    strcasecmp is called in the following places in Tcl 8.5.1
    
    + In the implementation of [lsort -nocase], [switch -nocase], [lsearch -nocase], and [lsearch -sorted -nocase]
    
    All of these uses were introduced by TIP#241.  The TIP does not specify whether "case-insensitive" means "ASCII-only", "locale-dependent", "UTF-aware but still ASCII-only", "according to one of the standardized Unicode normalization forms", or "what Tcl does elsewhere".  Presumably "what Tcl does elsewhere" (e.g., Tcl_StringCaseMatch, Tcl_UniCharToLower) is the most sensible.  strcasecmp() will typically be locale-dependent (or ASCII-only, which amounts to the same thing).  In any event, strcasecmp() is incorrect here, and causes portability problems.  This should be fixed.
    
    + In the definition of TclpInitLibraryPath().  This call was introduced 1999-04-15 <stanton> with the log message "merged tcl 8.1 branch back into the main trunk"; further details are lost to history.  It is not immediately clear to me why TclpInitLibraryPath is doing a case-insensitive comparison at this point, or indeed what it is doing at all.
    
    
  2. login: "jenglish"
  3. mimetype: "text/plain"
  4. username: "jenglish"