Remove some incomplete struct initializers
authorBen Kaduk <kaduk@mit.edu>
Mon, 21 Jul 2014 21:30:36 +0000 (17:30 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 13 Aug 2014 15:39:43 +0000 (11:39 -0400)
C99 requires that objects with static linkage, which includes
global variables, be initialized to zero/NULL.

It is possible that old compilers required a hack of using one
explicit initializer and relying on the requirement from C99 that
the elements of the structure not listed in the initializer be
initialized as if it had static linkage.  These incomplete initializers
seem to have been introduced to support old OS X compilers which
are not believed to still be in use.

Using a complete explicit initializer is undesired here, as the
rxkad statistics structures have a great number of elements and
the uuid structure is somewhat complicated.

Change-Id: Iefe7842cbf874252267cb3a8aee5d90ec2cab169
Reviewed-on: http://gerrit.openafs.org/11374
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/rxkad/rxkad_common.c
src/util/uuid.c

index 3133d29..0f14e4b 100644 (file)
 /* variable initialization for the benefit of darwin compiler; if it causes
    problems elsewhere, conditionalize for darwin or fc_test compile breaks */
 #ifdef AFS_PTHREAD_ENV
-struct rxkad_global_stats rxkad_global_stats = { 0 };
+struct rxkad_global_stats rxkad_global_stats;
 pthread_mutex_t rxkad_global_stats_lock;
 pthread_key_t rxkad_stats_key;
 #else /* AFS_PTHREAD_ENV */
-struct rxkad_stats rxkad_stats = { { 0 } };
+struct rxkad_stats rxkad_stats;
 #endif /* AFS_PTHREAD_ENV */
 
 #ifdef AFS_PTHREAD_ENV
index 5aaff37..dbf77d0 100644 (file)
@@ -98,7 +98,7 @@ void uuid__get_os_time(uuid_time_t * os_time);
  * +--------------------------...-----+
  */
 
-afsUUID afs_uuid_g_nil_uuid = { 0 };
+afsUUID afs_uuid_g_nil_uuid;
 static uuid_time_t time_now, time_last;
 static u_short uuid_time_adjust, clock_seq;
 static afs_uint32 rand_m, rand_ia, rand_ib, rand_irand, uuid_init_done = 0;