Skip to content

Commit 2d9fc13

Browse files
committed
Move ObjRef macros to tclInt.h; better location for them.
This should have been part of [2d7ae66265] in retrospect.
1 parent 04ecd21 commit 2d9fc13

File tree

3 files changed

+30
-31
lines changed

3 files changed

+30
-31
lines changed

generic/tclInt.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,6 +4295,36 @@ TclScaleTime(
42954295
} \
42964296
}
42974297

4298+
/*
4299+
* Primitives to safe set, reset and free references.
4300+
*/
4301+
4302+
#define TclUnsetObjRef(obj) \
4303+
do { \
4304+
if (obj != NULL) { \
4305+
Tcl_DecrRefCount(obj); \
4306+
obj = NULL; \
4307+
} \
4308+
} while (0)
4309+
#define TclInitObjRef(obj, val) \
4310+
do { \
4311+
obj = (val); \
4312+
if (obj) { \
4313+
Tcl_IncrRefCount(obj); \
4314+
} \
4315+
} while (0)
4316+
#define TclSetObjRef(obj, val) \
4317+
do { \
4318+
Tcl_Obj *nval = (val); \
4319+
if (obj != nval) { \
4320+
Tcl_Obj *prev = obj; \
4321+
TclInitObjRef(obj, nval); \
4322+
if (prev != NULL) { \
4323+
Tcl_DecrRefCount(prev); \
4324+
} \
4325+
} \
4326+
} while (0)
4327+
42984328
#if TCL_THREADS && !defined(USE_THREAD_ALLOC)
42994329
# define USE_THREAD_ALLOC 1
43004330
#endif

generic/tclResult.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "tclInt.h"
1313
#include <assert.h>
14-
#include "tclStrIdxTree.h"
1514

1615
/*
1716
* Indices of the standard return options dictionary keys.

generic/tclStrIdxTree.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -138,36 +138,6 @@ TclUtfFindEqualNCInLwr(
138138
} while ((ret = cs) < cse && cin < cine);
139139
return ret;
140140
}
141-
142-
/*
143-
* Primitives to safe set, reset and free references.
144-
*/
145-
146-
#define TclUnsetObjRef(obj) \
147-
do { \
148-
if (obj != NULL) { \
149-
Tcl_DecrRefCount(obj); \
150-
obj = NULL; \
151-
} \
152-
} while (0)
153-
#define TclInitObjRef(obj, val) \
154-
do { \
155-
obj = (val); \
156-
if (obj) { \
157-
Tcl_IncrRefCount(obj); \
158-
} \
159-
} while (0)
160-
#define TclSetObjRef(obj, val) \
161-
do { \
162-
Tcl_Obj *nval = (val); \
163-
if (obj != nval) { \
164-
Tcl_Obj *prev = obj; \
165-
TclInitObjRef(obj, nval); \
166-
if (prev != NULL) { \
167-
Tcl_DecrRefCount(prev); \
168-
} \
169-
} \
170-
} while (0)
171141

172142
/*
173143
* Prototypes of module functions.

0 commit comments

Comments
 (0)