about summary refs log tree commit diff
path: root/nss/nss_files/files-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nss_files/files-parse.c')
-rw-r--r--nss/nss_files/files-parse.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c
index be35ae1a8a..a9c461ef46 100644
--- a/nss/nss_files/files-parse.c
+++ b/nss/nss_files/files-parse.c
@@ -35,7 +35,7 @@ struct parser_data
   {
 #ifdef ENTDATA
     struct ENTDATA entdata;
-#define ENTDATA_DECL(data) struct ENTDATA *const entdata = &data->entdata
+#define ENTDATA_DECL(data) struct ENTDATA *const entdata = &data->entdata;
 #else
 #define ENTDATA_DECL(data)
 #endif
@@ -52,26 +52,21 @@ struct parser_data
 #define parse_line CONCAT(_nss_files_parse_,ENTNAME)
 #endif
 
-#define LINE_PARSER(BODY)						      \
+#define LINE_PARSER(EOLSET, BODY)					      \
 parser_stclass int							      \
 parse_line (char *line, struct STRUCTURE *result,			      \
 	    struct parser_data *data, int datalen)			      \
 {									      \
-  ENTDATA_DECL (data);							      \
+  ENTDATA_DECL (data)							      \
+  char *p = strpbrk (line, EOLSET "\n");				      \
+  if (p)								      \
+    *p = '\0';								      \
   BODY;									      \
   TRAILING_LIST_PARSER;							      \
   return 1;								      \
 }
 
 
-/* Comments can come mid-line; trim the line at the first # seen.  */
-#define MIDLINE_COMMENTS						      \
-  {									      \
-    char *p = strchr (line, '#');					      \
-    if (p)								      \
-      *p = '\0';							      \
-  }
-
 #define STRING_FIELD(variable, terminator_p, swallow)			      \
   {									      \
     variable = line;							      \