Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | merge 8.6 |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | core-8-branch |
Files: | files | file ages | folders |
SHA3-256: |
87fbb05e7fb718c011ce1ada5a203640 |
User & Date: | dgp 2018-03-12 14:17:52.356 |
Context
2018-03-12
| ||
14:41 | Revert change that broke usage with Tcl 9 check-in: 8791050e93 user: dgp tags: core-8-branch | |
14:17 | merge 8.6 check-in: 87fbb05e7f user: dgp tags: core-8-branch | |
14:14 | Implement TIP 499: Custom locale search list for msgcat check-in: c37cf7f1dd user: dgp tags: core-8-branch | |
02:48 | It is confusingly stupid to use variable "length" to hold an actual length in part of a routine, and... check-in: 4d996dc6aa user: dgp tags: core-8-6-branch | |
Changes
Changes to generic/tclCmdMZ.c.
︙ | ︙ | |||
2301 2302 2303 2304 2305 2306 2307 | static int StringRplcCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { | < | | | | | > > > > > | > > > > > > > > | > | | | | 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 | static int StringRplcCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int first, last, length, end; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 1, objv, "string first last ?string?"); return TCL_ERROR; } (void) Tcl_GetUnicodeFromObj(objv[1], &length); end = length - 1; if (TclGetIntForIndexM(interp, objv[2], end, &first) != TCL_OK || TclGetIntForIndexM(interp, objv[3], end, &last) != TCL_OK){ return TCL_ERROR; } /* * [string replace] does not replace empty strings. This is * unwise, but since it is true, here we quickly screen out * index pairs that demarcate an empty substring. */ if ((last < 0) || /* Range ends before start of string */ (first > end) || /* Range begins after end of string */ (last < first)) { /* Range begins after it starts */ Tcl_SetObjResult(interp, objv[1]); } else { Tcl_Obj *resultPtr; /* * We are re-fetching in case the string argument is same value as * an index argument, and shimmering cost us our ustring. */ Tcl_UniChar *ustring = Tcl_GetUnicodeFromObj(objv[1], &length); end = length - 1; if (first < 0) { first = 0; } resultPtr = Tcl_NewUnicodeObj(ustring, first); if (objc == 5) { Tcl_AppendObjToObj(resultPtr, objv[4]); } if (last < end) { Tcl_AppendUnicodeToObj(resultPtr, ustring + last + 1, end - last); } Tcl_SetObjResult(interp, resultPtr); } return TCL_OK; } /* |
︙ | ︙ |