summaryrefslogtreecommitdiffstats
path: root/generic/tclOOInt.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-08 09:35:57 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-08 09:35:57 (GMT)
commit0d8a08dbf1d766bcd778253199b782a231a202e7 (patch)
tree241f416217b98adc7b64a208c548f4dd0ac880b3 /generic/tclOOInt.h
parent4dcdd51adbe299efe67dc9aa9c2034df855aef28 (diff)
downloadtcl-0d8a08dbf1d766bcd778253199b782a231a202e7.zip
tcl-0d8a08dbf1d766bcd778253199b782a231a202e7.tar.gz
tcl-0d8a08dbf1d766bcd778253199b782a231a202e7.tar.bz2
Proposed fix for [96551aca55]: Avoid pointer arithmetic with NULL in FOREACH_STRUCT()
Diffstat (limited to 'generic/tclOOInt.h')
-rw-r--r--generic/tclOOInt.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h
index 725c4ce..8a19f74 100644
--- a/generic/tclOOInt.h
+++ b/generic/tclOOInt.h
@@ -589,12 +589,12 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
/*
* A variation where the array is an array of structs. There's no issue with
* possible NULLs; every element of the array will be iterated over and the
- * varable set to a pointer to each of those elements in turn.
+ * variable set to a pointer to each of those elements in turn.
* REQUIRES DECLARATION: int i;
*/
#define FOREACH_STRUCT(var,ary) \
- for(i=0 ; var=&((ary).list[i]), i<(ary).num; i++)
+ if ((ary).num > 0) for(i=0; var=&((ary).list[i]), i<(ary).num; i++)
/*
* Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS