[Zope3-checkins] CVS: Zope3/src/zodb/btrees - BucketTemplate.c:1.16
Tim Peters
tim.one@comcast.net
Wed, 16 Apr 2003 11:59:04 -0400
Update of /cvs-repository/Zope3/src/zodb/btrees
In directory cvs.zope.org:/tmp/cvs-serv20148/src/zodb/btrees
Modified Files:
BucketTemplate.c
Log Message:
bucket_set(): Expanded the comment on the gcc-wng-squashing initialization
hack.
=== Zope3/src/zodb/btrees/BucketTemplate.c 1.15 => 1.16 ===
--- Zope3/src/zodb/btrees/BucketTemplate.c:1.15 Wed Apr 16 11:21:50 2003
+++ Zope3/src/zodb/btrees/BucketTemplate.c Wed Apr 16 11:59:04 2003
@@ -296,11 +296,18 @@
{
int i, cmp;
KEY_TYPE key;
- VALUE_TYPE value = {0}; /* Subtle: VALUE_TYPE can be various types,
- including a 6-char array,
- but {0} is always a valid initializer.
- Without an initialization, GCC warns about
- this variable being used uninitialized. */
+
+ /* Subtle: there may or may not be a value. If there is, we need to
+ * check its type early, so that in case of error we can get out before
+ * mutating the bucket. But because value isn't used on all paths, if
+ * we don't initialize value then gcc gives a nuisance complaint that
+ * value may be used initialized (it can't be, but gcc doesn't know
+ * that). So we initialize it. However, VALUE_TYPE can be various types,
+ * including int, PyObject*, and char[6], so it's a puzzle to spell
+ * initialization. It so happens that {0} is a valid initializer for all
+ * these types.
+ */
+ VALUE_TYPE value = {0}; /* squash nuisance warning */
int result = -1; /* until proven innocent */
int copied = 1;