about summary refs log tree commit diff
path: root/nss/nss_files/files-parse.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-01 22:16:41 +0000
committerRoland McGrath <roland@gnu.org>1996-07-01 22:16:41 +0000
commit3776d592f117c8c5b0d2c37d265cb8ee2ac21695 (patch)
tree9cae15e988bc6b4eb1e2737db59bceaab58e0be7 /nss/nss_files/files-parse.c
parent7cbc698400bfe2a64f12b0cb703fda0fdecb5a59 (diff)
downloadglibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.tar.gz
glibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.tar.xz
glibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.zip
Mon Jul 1 12:29:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
	* nss/Makefile (databases): Change host to hosts.
	* nss/host-lookup.c: Renamed to nss/hosts-lookup.c.
Diffstat (limited to 'nss/nss_files/files-parse.c')
-rw-r--r--nss/nss_files/files-parse.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c
index de456995a2..be35ae1a8a 100644
--- a/nss/nss_files/files-parse.c
+++ b/nss/nss_files/files-parse.c
@@ -33,17 +33,31 @@ Cambridge, MA 02139, USA.  */
 
 struct parser_data
   {
-    struct CONCAT(ENTNAME,_data) entdata;
+#ifdef ENTDATA
+    struct ENTDATA entdata;
+#define ENTDATA_DECL(data) struct ENTDATA *const entdata = &data->entdata
+#else
+#define ENTDATA_DECL(data)
+#endif
     char linebuffer[0];
   };
 
+#ifdef ENTDATA
+/* The function can't be exported, because the entdata structure
+   is defined only in files-foo.c.  */
+#define parser_stclass static inline
+#else
+/* Export the line parser function so it can be used in nss_db.  */
+#define parser_stclass /* Global */
+#define parse_line CONCAT(_nss_files_parse_,ENTNAME)
+#endif
+
 #define LINE_PARSER(BODY)						      \
-static inline int							      \
+parser_stclass int							      \
 parse_line (char *line, struct STRUCTURE *result,			      \
 	    struct parser_data *data, int datalen)			      \
 {									      \
-  struct CONCAT(ENTNAME,_data) *const entdata __attribute__ ((unused))	      \
-    = &data->entdata;		      					      \
+  ENTDATA_DECL (data);							      \
   BODY;									      \
   TRAILING_LIST_PARSER;							      \
   return 1;								      \
@@ -107,9 +121,10 @@ parse_list (char *line, struct parser_data *data, int datalen)
   char *eol, **list, **p;
 
   /* Find the end of the line buffer.  */
-  eol = strchr (line, '\0') + 1;
+  eol = strchr (data->linebuffer, '\0') + 1;
   /* Adjust the pointer so it is aligned for storing pointers.  */
-  eol += (eol - (char *) 0) % __alignof__ (char *);
+  eol += __alignof__ (char *) - 1;
+  eol -= (eol - (char *) 0) % __alignof__ (char *);
   /* We will start the storage here for the vector of pointers.  */
   list = (char **) eol;