Author: Ashok P. Nadkarni <[email protected]>
State: Final
Type: Project
Vote: Done
Created: 17-Nov-2022
Tcl-Version: 8.7
Tcl-branch: tip-651
Vote-Summary: Accepted 3/0/0
Votes-For: BG, JN, SL
Votes-Against: none
Votes-Present: none
Abstract
The Tcl_DString
abstraction is very useful in incrementally building
strings and binary data. In common usage in extensions, the resulting string
is used to initialize a Tcl_Obj
and the source Tcl_DString
freed. This
involves allocating new storage and a byte copy and is not efficient. Within
the core, the function TclDStringToObj
provides a more efficient means
which moves the allocated storage to the Tcl_Obj
and resets the
Tcl_DString
. This TIP proposes making this function available to
extensions as Tcl_DStringToObj
.
Specification
The following function will be exported via the stubs table.
Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr);
The function returns a Tcl_Obj
initialized with the content of dsPtr
which
is then reinitialized to an empty string.
Implementation
Implementation is available in the tip-651 branch of the Tcl repository.
Copyright
This document has been placed in the public domain.