This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] C99 initializers for four nscd files


Hi.

Here are four patches that replace GCC's obsolete method of initializing
structures with C99 initializers. I have more patches like this to
send if there is interest in switching to the C99 style. These
patches are against the current CVS.

Art Haas

2002-12-15  Art Haas  <ahaas@airmail.net>

	* nscd/connections.c: C99 initializer conversion.
	* nscd/grpcache.c: Same.
	* nscd/hstcache.c: Same.
	* nscd/pwdcache.c: Same.

Index: connections.c
===================================================================
RCS file: /cvs/glibc/libc/nscd/connections.c,v
retrieving revision 1.32
diff -u -r1.32 connections.c
--- connections.c	5 Sep 2002 18:51:46 -0000	1.32
+++ connections.c	15 Dec 2002 16:15:47 -0000
@@ -90,34 +90,34 @@
 static struct database dbs[lastdb] =
 {
   [pwddb] = {
-    lock: PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
-    enabled: 0,
-    check_file: 1,
-    filename: "/etc/passwd",
-    module: 211,
-    disabled_iov: &pwd_iov_disabled,
-    postimeout: 3600,
-    negtimeout: 20
+    .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+    .enabled = 0,
+    .check_file = 1,
+    .filename = "/etc/passwd",
+    .module = 211,
+    .disabled_iov = &pwd_iov_disabled,
+    .postimeout = 3600,
+    .negtimeout = 20
   },
   [grpdb] = {
-    lock: PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
-    enabled: 0,
-    check_file: 1,
-    filename: "/etc/group",
-    module: 211,
-    disabled_iov: &grp_iov_disabled,
-    postimeout: 3600,
-    negtimeout: 60
+    .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+    .enabled = 0,
+    .check_file = 1,
+    .filename = "/etc/group",
+    .module = 211,
+    .disabled_iov = &grp_iov_disabled,
+    .postimeout = 3600,
+    .negtimeout = 60
   },
   [hstdb] = {
-    lock: PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
-    enabled: 0,
-    check_file: 1,
-    filename: "/etc/hosts",
-    module: 211,
-    disabled_iov: &hst_iov_disabled,
-    postimeout: 3600,
-    negtimeout: 20
+    .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+    .enabled = 0,
+    .check_file = 1,
+    .filename = "/etc/hosts",
+    .module = 211,
+    .disabled_iov = &hst_iov_disabled,
+    .postimeout = 3600,
+    .negtimeout = 20
   }
 };
 
Index: grpcache.c
===================================================================
RCS file: /cvs/glibc/libc/nscd/grpcache.c,v
retrieving revision 1.24
diff -u -r1.24 grpcache.c
--- grpcache.c	22 Mar 2002 07:15:47 -0000	1.24
+++ grpcache.c	15 Dec 2002 16:15:49 -0000
@@ -37,38 +37,38 @@
 /* This is the standard reply in case the service is disabled.  */
 static const gr_response_header disabled =
 {
-  version: NSCD_VERSION,
-  found: -1,
-  gr_name_len: 0,
-  gr_passwd_len: 0,
-  gr_gid: -1,
-  gr_mem_cnt: 0,
+  .version = NSCD_VERSION,
+  .found = -1,
+  .gr_name_len = 0,
+  .gr_passwd_len = 0,
+  .gr_gid = -1,
+  .gr_mem_cnt = 0,
 };
 
 /* This is the struct describing how to write this record.  */
 const struct iovec grp_iov_disabled =
 {
-  iov_base: (void *) &disabled,
-  iov_len: sizeof (disabled)
+  .iov_base = (void *) &disabled,
+  .iov_len = sizeof (disabled)
 };
 
 
 /* This is the standard reply in case we haven't found the dataset.  */
 static const gr_response_header notfound =
 {
-  version: NSCD_VERSION,
-  found: 0,
-  gr_name_len: 0,
-  gr_passwd_len: 0,
-  gr_gid: -1,
-  gr_mem_cnt: 0,
+  .version = NSCD_VERSION,
+  .found = 0,
+  .gr_name_len = 0,
+  .gr_passwd_len = 0,
+  .gr_gid = -1,
+  .gr_mem_cnt = 0,
 };
 
 /* This is the struct describing how to write this record.  */
 static const struct iovec iov_notfound =
 {
-  iov_base: (void *) &notfound,
-  iov_len: sizeof (notfound)
+  .iov_base = (void *) &notfound,
+  .iov_len = sizeof (notfound)
 };
 
 
Index: hstcache.c
===================================================================
RCS file: /cvs/glibc/libc/nscd/hstcache.c,v
retrieving revision 1.19
diff -u -r1.19 hstcache.c
--- hstcache.c	26 Aug 2002 08:32:40 -0000	1.19
+++ hstcache.c	15 Dec 2002 16:15:49 -0000
@@ -41,42 +41,42 @@
 /* This is the standard reply in case the service is disabled.  */
 static const hst_response_header disabled =
 {
-  version: NSCD_VERSION,
-  found: -1,
-  h_name_len: 0,
-  h_aliases_cnt: 0,
-  h_addrtype: -1,
-  h_length: -1,
-  h_addr_list_cnt: 0,
-  error: NETDB_INTERNAL
+  .version = NSCD_VERSION,
+  .found = -1,
+  .h_name_len = 0,
+  .h_aliases_cnt = 0,
+  .h_addrtype = -1,
+  .h_length = -1,
+  .h_addr_list_cnt = 0,
+  .error = NETDB_INTERNAL
 };
 
 /* This is the struct describing how to write this record.  */
 const struct iovec hst_iov_disabled =
 {
-  iov_base: (void *) &disabled,
-  iov_len: sizeof (disabled)
+  .iov_base = (void *) &disabled,
+  .iov_len = sizeof (disabled)
 };
 
 
 /* This is the standard reply in case we haven't found the dataset.  */
 static const hst_response_header notfound =
 {
-  version: NSCD_VERSION,
-  found: 0,
-  h_name_len: 0,
-  h_aliases_cnt: 0,
-  h_addrtype: -1,
-  h_length: -1,
-  h_addr_list_cnt: 0,
-  error: HOST_NOT_FOUND
+  .version = NSCD_VERSION,
+  .found = 0,
+  .h_name_len = 0,
+  .h_aliases_cnt = 0,
+  .h_addrtype = -1,
+  .h_length = -1,
+  .h_addr_list_cnt = 0,
+  .error = HOST_NOT_FOUND
 };
 
 /* This is the struct describing how to write this record.  */
 static const struct iovec iov_notfound =
 {
-  iov_base: (void *) &notfound,
-  iov_len: sizeof (notfound)
+  .iov_base = (void *) &notfound,
+  .iov_len = sizeof (notfound)
 };
 
 
Index: pwdcache.c
===================================================================
RCS file: /cvs/glibc/libc/nscd/pwdcache.c,v
retrieving revision 1.23
diff -u -r1.23 pwdcache.c
--- pwdcache.c	22 Mar 2002 07:14:00 -0000	1.23
+++ pwdcache.c	15 Dec 2002 16:15:49 -0000
@@ -37,44 +37,44 @@
 /* This is the standard reply in case the service is disabled.  */
 static const pw_response_header disabled =
 {
-  version: NSCD_VERSION,
-  found: -1,
-  pw_name_len: 0,
-  pw_passwd_len: 0,
-  pw_uid: -1,
-  pw_gid: -1,
-  pw_gecos_len: 0,
-  pw_dir_len: 0,
-  pw_shell_len: 0
+  .version = NSCD_VERSION,
+  .found = -1,
+  .pw_name_len = 0,
+  .pw_passwd_len = 0,
+  .pw_uid = -1,
+  .pw_gid = -1,
+  .pw_gecos_len = 0,
+  .pw_dir_len = 0,
+  .pw_shell_len = 0
 };
 
 /* This is the struct describing how to write this record.  */
 const struct iovec pwd_iov_disabled =
 {
-  iov_base: (void *) &disabled,
-  iov_len: sizeof (disabled)
+  .iov_base = (void *) &disabled,
+  .iov_len = sizeof (disabled)
 };
 
 
 /* This is the standard reply in case we haven't found the dataset.  */
 static const pw_response_header notfound =
 {
-  version: NSCD_VERSION,
-  found: 0,
-  pw_name_len: 0,
-  pw_passwd_len: 0,
-  pw_uid: -1,
-  pw_gid: -1,
-  pw_gecos_len: 0,
-  pw_dir_len: 0,
-  pw_shell_len: 0
+  .version = NSCD_VERSION,
+  .found = 0,
+  .pw_name_len = 0,
+  .pw_passwd_len = 0,
+  .pw_uid = -1,
+  .pw_gid = -1,
+  .pw_gecos_len = 0,
+  .pw_dir_len = 0,
+  .pw_shell_len = 0
 };
 
 /* This is the struct describing how to write this record.  */
 static const struct iovec iov_notfound =
 {
-  iov_base: (void *) &notfound,
-  iov_len: sizeof (notfound)
+  .iov_base = (void *) &notfound,
+  .iov_len = sizeof (notfound)
 };
 
 
-- 
They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety.
 -- Benjamin Franklin, Historical Review of Pennsylvania, 1759


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]