Skip to content
Tcl Source Code History Of Ticket 1529526
Login

History Of Ticket 1529526

Artifacts Associated With Ticket 1529526

  1. Ticket change [271c6d31b8] (rid 88462) by afredd on 2006-07-27 08:15:07:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      In the call to Tcl_SetStringObj in the STORE_ARY macro
      in StoreStatData(), the string length can be
      determined since they are all string literals.
      So the attached patch saves unnecesary 12 strlen()s
      per call to "file stat ...".
      NB. The use of ("" fieldName) is simply to ensure that
      if STORE_ARY is called with something other than
      a string literal as the fieldName, then the compiler
      will helpfully given an error. 
      
      --
      This same technique of determining the length of a
      string literal using (sizeof(strLit) - 1) could be
      useful for Tcl_NewStringObj & Tcl_DStringAppend which
      are often called with a string literal and a length
      of -1 in the core. So something like these macros
      added to tclInt.h and then used in the core would
      save some additional unnecesary strlen()s:
      
      
      /* Macro to determine the length of a "string literal"
       * at compile time.
       * NB. The use of (strLit "") below ensures that the
       * compiler will report an error if anything other
       * than a string literal is given to the macro.
       */
      #define StrLitLen(strLit) \
        ((int) (sizeof(strLit "") - 1))
      
      #define TclNewStrLitObj(strLit) \
        Tcl_NewStringObj(strLit, strLitLen(strLit))
      
      #define TclDStrLitAppend(dsPtr, strLit) \
        Tcl_DStringAppend(dsPtr, strLit, strLitLen(strLit))
      
      
      
      So calls like:
        Tcl_NewStringObj("foo", -1)
      would then be written as
        TclNewStrLitObj("foo")
      and would be expanded as
        Tcl_NewStringObj("foo", 3)
      
      
      (There are about 100 calls to Tcl_NewStringObj &
      Tcl_DStringAppend which could use these macros to
      avoid an unnecesary strlen) 
      
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "afredd"
    10. subsystem initialized to: "16. Commands A-H"
    11. title initialized to: "Avoid some unnecesary strlen()s"
    12. type initialized to: "Patch"
  2. Add attachment "tclCmdAH.c-diff" [e630043229] (rid 104260) by afredd on 2006-07-27 15:15:08.

  3. Ticket change [ba92944e95] (rid 129341) by afredd on 2006-07-27 15:15:08:

    1. icomment:
      
      
      File Added - 186420: tclCmdAH.c-diff
      
      
      
    2. login: "afredd"
    3. mimetype: "text/plain"
    4. username: "afredd"
  4. Ticket change [de438c114d] (rid 114815) by dkf on 2007-04-10 21:48:54:

    1. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Adopted some of this via a new macro TclNewLiteralStringObj
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  5. Ticket change [ca25f55692] (rid 122413) by dkf on 2007-09-17 20:23:23:

    1. closedate changed to: "2007-09-17T13:23:23"
    2. closer changed to: "dkf"
    3. icomment:
      Logged In: YES 
      user_id=79902
      Originator: NO
      
      Only error handling code now uses the slow version
      
      
    4. login: "dkf"
    5. mimetype: "text/plain"
    6. resolution changed to: "Accepted"
    7. status changed to: "Closed"
    8. username: "dkf"