Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dae6291141b7525189117c2f879245ad23ff8594
Ticket: 1357401fffffffffffffffffffffffffffffffff
Add Tcl_DStringClear & Tcl_DStringAppendDString to tcl.h
User & Date: nobody on 2005-11-15 14:11:20
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The following two simple DString macros would be
    useful both in the Tcl core itself and for the general
    Tcl extension writer.
    
    
    #define Tcl_DStringClear(dsPtr) \
      ((dsPtr)->string[((dsPtr)->length = 0)] = '\0')
    
    #define Tcl_DStringAppendDString(dsPtr,ds2Ptr) \
      Tcl_DStringAppend((dsPtr), \
        Tcl_DStringValue(ds2Ptr), \
        Tcl_DStringLength(ds2Ptr) \
      )
    
    
    
    The first, Tcl_DStringClear, simply clears an already 
    Init'd DString's buffer.
    
    For cases where this is useful (to reuse a DString), the 
    core currently either does a Tcl_DStringFree() or
    a Tcl_DStringSetLength(...,0) neither of which is ideal.
    In particular using Tcl_DStringFree might free a malloc'd
    buffer which might have to be re-malloced. 
    The new macro would also help documenting the
    code's intention.
    
    The second is simply a wrapper around 
    Tcl_DStringAppend which simplifies and self documents
    the code so that it is obvious that what is being
    appended is a Tcl_DString.
    
    
  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: "None"
  10. title changed to:
    Add Tcl_DStringClear & Tcl_DStringAppendDString to tcl.h
    
  11. type changed to: "RFE"