Changeset 7692efc in git for external/tcl/tclStringObj.c
- Timestamp:
- Aug 16, 2019, 11:14:50 AM (5 years ago)
- Branches:
- ImprovedOutputFile, Timing, master
- Children:
- 0e7d64a
- Parents:
- 94f8f5f (diff), 270bd4f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/tcl/tclStringObj.c
r94f8f5f r7692efc 50 50 * Tcl_NewStringObj -- 51 51 * 52 * This procedure is normally called when not debugging: i.e., when 53 * TCL_MEM_DEBUG is not defined. It creates a new string object and 54 * initializes it from the byte pointer and length arguments. 55 * 56 * When TCL_MEM_DEBUG is defined, this procedure just returns the 57 * result of calling the debugging version Tcl_DbNewStringObj. 52 * This procedure creates a new string object and initializes it from 53 * the byte pointer and length arguments. 58 54 * 59 55 * Results: … … 70 66 *---------------------------------------------------------------------- 71 67 */ 72 73 #ifdef TCL_MEM_DEBUG74 #undef Tcl_NewStringObj75 68 76 69 Tcl_Obj * … … 83 76 * NULL byte. */ 84 77 { 85 return Tcl_DbNewStringObj(bytes, length, "unknown", 0);86 }87 88 #else /* if not TCL_MEM_DEBUG */89 90 Tcl_Obj *91 Tcl_NewStringObj(bytes, length)92 register char *bytes; /* Points to the first of the length bytes93 * used to initialize the new object. */94 register int length; /* The number of bytes to copy from "bytes"95 * when initializing the new object. If96 * negative, use bytes up to the first97 * NULL byte. */98 {99 78 register Tcl_Obj *objPtr; 100 79 … … 106 85 return objPtr; 107 86 } 108 #endif /* TCL_MEM_DEBUG */109 110 111 /*112 *----------------------------------------------------------------------113 *114 * Tcl_DbNewStringObj --115 *116 * This procedure is normally called when debugging: i.e., when117 * TCL_MEM_DEBUG is defined. It creates new string objects. It is the118 * same as the Tcl_NewStringObj procedure above except that it calls119 * Tcl_DbCkalloc directly with the file name and line number from its120 * caller. This simplifies debugging since then the checkmem command121 * will report the correct file name and line number when reporting122 * objects that haven't been freed.123 *124 * When TCL_MEM_DEBUG is not defined, this procedure just returns the125 * result of calling Tcl_NewStringObj.126 *127 * Results:128 * A newly created string object is returned that has ref count zero.129 *130 * Side effects:131 * The new object's internal string representation will be set to a132 * copy of the length bytes starting at "bytes". If "length" is133 * negative, use bytes up to the first NULL byte; i.e., assume "bytes"134 * points to a C-style NULL-terminated string. The object's type is set135 * to NULL. An extra NULL is added to the end of the new object's byte136 * array.137 *138 *----------------------------------------------------------------------139 */140 141 #ifdef TCL_MEM_DEBUG142 143 Tcl_Obj *144 Tcl_DbNewStringObj(bytes, length, file, line)145 register char *bytes; /* Points to the first of the length bytes146 * used to initialize the new object. */147 register int length; /* The number of bytes to copy from "bytes"148 * when initializing the new object. If149 * negative, use bytes up to the first150 * NULL byte. */151 char *file; /* The name of the source file calling this152 * procedure; used for debugging. */153 int line; /* Line number in the source file; used154 * for debugging. */155 {156 register Tcl_Obj *objPtr;157 158 if (length < 0) {159 length = (bytes? strlen(bytes) : 0);160 }161 TclDbNewObj(objPtr, file, line);162 TclInitStringRep(objPtr, bytes, length);163 return objPtr;164 }165 166 #else /* if not TCL_MEM_DEBUG */167 168 Tcl_Obj *169 Tcl_DbNewStringObj(bytes, length, file, line)170 register char *bytes; /* Points to the first of the length bytes171 * used to initialize the new object. */172 register int length; /* The number of bytes to copy from "bytes"173 * when initializing the new object. If174 * negative, use bytes up to the first175 * NULL byte. */176 char *file; /* The name of the source file calling this177 * procedure; used for debugging. */178 int line; /* Line number in the source file; used179 * for debugging. */180 {181 return Tcl_NewStringObj(bytes, length);182 }183 #endif /* TCL_MEM_DEBUG */184 87 185 88
Note:
See TracChangeset
for help on using the changeset viewer.