<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/4bbcbdefff1ab5d2ed6da454b5593502fc3c6645">https://github.com/macports/macports-base/commit/4bbcbdefff1ab5d2ed6da454b5593502fc3c6645</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 4bbcbdefff1ab5d2ed6da454b5593502fc3c6645
</span>Author: Clemens Lang <cal@macports.org>
AuthorDate: Tue Oct 31 11:19:38 2023 +0100
<span style='display:block; white-space:pre;color:#404040;'> registry2.0/snapshotobj: Don't stringify integer
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> There's no need to convert the snapshot ID to a string before handing it
</span><span style='display:block; white-space:pre;color:#404040;'> to Tcl if we instead Tcl_NewLongObj. This leaves the job of turning the
</span><span style='display:block; white-space:pre;color:#404040;'> integer into a string (should that be required) to Tcl, which already
</span><span style='display:block; white-space:pre;color:#404040;'> has routines to do so.
</span>---
src/registry2.0/snapshotobj.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/registry2.0/snapshotobj.c b/src/registry2.0/snapshotobj.c
</span><span style='display:block; white-space:pre;color:#808080;'>index 4c0a66ec3..cfcfb628d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/registry2.0/snapshotobj.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/registry2.0/snapshotobj.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -62,11 +62,9 @@ static int snapshot_obj_id(Tcl_Interp* interp, reg_snapshot* snapshot, int objc,
</span> }
if (objc == 2) {
/* ${snapshot} id; return the current value */
<span style='display:block; white-space:pre;background:#ffe0e0;'>- char value[sizeof(snapshot->id)+1];
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sprintf(value, "%lld", snapshot->id);
</span> if (Tcl_GetIndexFromObj(interp, objv[1], snapshot_props, "prop", 0, &index)
== TCL_OK) {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- Tcl_Obj* result = Tcl_NewStringObj(value, -1);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Tcl_Obj* result = Tcl_NewLongObj(snapshot->id);
</span> Tcl_SetObjResult(interp, result);
return TCL_OK;
}
</pre><pre style='margin:0'>
</pre>