Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1cc51195d0526aa9c8690da38dcb8508bf966ea0
Ticket: 428572ffffffffffffffffffffffffffffffffff
Tcl_DStringAppendElement speedup
User & Date: nobody on 2001-05-30 07:04:45
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    This patch avoids a repeated strlen call by using
    the Counted versions of ScanElement and ConvertElement.
    
    Index: tclUtil.c
    =======================================================
    ============
    RCS file: /cvsroot/tcl/tcl/generic/tclUtil.c,v
    retrieving revision 1.18
    diff -c -r1.18 tclUtil.c
    *** tclUtil.c   2000/05/08 21:59:59     1.18
    --- tclUtil.c   2001/05/30 06:57:32
    ***************
    *** 1452,1459 ****
      {
          int newSize, flags;
          char *dst;
      
    !     newSize = Tcl_ScanElement(string, &flags) + 
    dsPtr->length + 1;
      
          /*
           * Allocate a larger buffer for the string if 
    the current one isn't
    --- 1452,1461 ----
      {
          int newSize, flags;
          char *dst;
    +     int stringSize;
      
    !     stringSize = strlen (string);
    !     newSize = Tcl_ScanCountedElement(string, 
    stringSize, &flags) + dsPtr->length + 1;
      
          /*
           * Allocate a larger buffer for the string if 
    the current one isn't
    ***************
    *** 1490,1496 ****
            dst++;
            dsPtr->length++;
          }
    !     dsPtr->length += Tcl_ConvertElement(string, dst, 
    flags);
          return dsPtr->string;
      }
      
    
    --- 1492,1498 ----
            dst++;
            dsPtr->length++;
          }
    !     dsPtr->length += Tcl_ConvertCountedElement
    (string, stringSize, dst, flags);
          return dsPtr->string;
      }
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "11. Conversions from String"
  10. title changed to: "Tcl_DStringAppendElement speedup"
  11. type changed to: "Patch"