Differences From Artifact [96a3e40d5923a5f6]:
- File
jim.c
-
2011-06-10 04:00:35
- part of checkin
[b956403ce1]
on branch trunk
- Allow [info complete] to determine the missing char
Signed-off-by: Steve Bennett <steveb@workware.net.au> (user: steveb@workware.net.au
-
2011-06-10 04:00:35
- part of checkin
[b956403ce1]
on branch trunk
- Allow [info complete] to determine the missing char
To Artifact [1402f15b7dbe0fab]:
- File
jim.c
-
2011-06-21 12:37:30
- part of checkin
[09de628c58]
on branch trunk
- Fix crash on dup of object with script rep
Signed-off-by: Steve Bennett <steveb@workware.net.au> (user: steveb@workware.net.au
-
2011-06-21 12:37:30
- part of checkin
[09de628c58]
on branch trunk
- Fix crash on dup of object with script rep
132 132 static int JimValidName(Jim_Interp *interp, const char *type, Jim_Obj *nameObjPtr);
133 133
134 134 static const Jim_HashTableType JimVariablesHashTableType;
135 135
136 136 /* Fast access to the int (wide) value of an object which is known to be of int type */
137 137 #define JimWideValue(objPtr) (objPtr)->internalRep.wideValue
138 138
139 +#define JimObjTypeName(O) (objPtr->typePtr ? objPtr->typePtr->name : "none")
140 +
139 141 static int utf8_tounicode_case(const char *s, int *uc, int upper)
140 142 {
141 143 int l = utf8_tounicode(s, uc);
142 144 if (upper) {
143 145 *uc = utf8_upper(*uc);
144 146 }
145 147 return l;
................................................................................
2149 2151 if (objPtr->bytes == NULL) {
2150 2152 /* Object does not have a valid string representation. */
2151 2153 dupPtr->bytes = NULL;
2152 2154 }
2153 2155 else {
2154 2156 Jim_InitStringRep(dupPtr, objPtr->bytes, objPtr->length);
2155 2157 }
2158 +
2159 + /* By default, the new object has the same type as the old object */
2160 + dupPtr->typePtr = objPtr->typePtr;
2156 2161 if (objPtr->typePtr != NULL) {
2157 2162 if (objPtr->typePtr->dupIntRepProc == NULL) {
2158 2163 dupPtr->internalRep = objPtr->internalRep;
2159 2164 }
2160 2165 else {
2166 + /* The dup proc may set a different type, e.g. NULL */
2161 2167 objPtr->typePtr->dupIntRepProc(interp, objPtr, dupPtr);
2162 2168 }
2163 - dupPtr->typePtr = objPtr->typePtr;
2164 - }
2165 - else {
2166 - dupPtr->typePtr = NULL;
2167 2169 }
2168 2170 return dupPtr;
2169 2171 }
2170 2172
2171 2173 /* Return the string representation for objPtr. If the object
2172 2174 * string representation is invalid, calls the method to create
2173 2175 * a new one starting from the internal representation of the object. */