This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit abd165bc17c04821d74f190367fe955d14a102d9
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Jul 28 19:16:57 2023 +0200

    epp: Remove unused USE_FILE_NAME_MAPS stuff
---
 epp/cpplib.c | 194 -----------------------------------------------------------
 1 file changed, 194 deletions(-)

diff --git a/epp/cpplib.c b/epp/cpplib.c
index 54dbf805..f4e7c110 100644
--- a/epp/cpplib.c
+++ b/epp/cpplib.c
@@ -111,8 +111,6 @@ const char         *version_string = "0.0.0";
 #define INCLUDE_LEN_FUDGE 0
 #endif
 
-#define USE_FILE_NAME_MAPS 0
-
 /* Symbols to predefine.  */
 
 #ifdef CPP_PREDEFINES
@@ -5307,197 +5305,6 @@ struct file_name_map {
    char               *map_to;
 };
 
-#if USE_FILE_NAME_MAPS
-
-#define FILE_NAME_MAP_FILE "header.gcc"
-
-/* Read a space delimited string of unlimited length from a stdio
- * file.  */
-
-static char        *
-read_filename_string(int ch, FILE * f)
-{
-   char               *alloc, *set;
-   int                 len;
-
-   len = 20;
-   set = alloc = (char *)xmalloc(len + 1);
-   if (!is_space[ch])
-     {
-	*set++ = ch;
-	while ((ch = getc(f)) != EOF && !is_space[ch])
-	  {
-	     if (set - alloc == len)
-	       {
-		  len *= 2;
-		  alloc = (char *)xrealloc(alloc, len + 1);
-		  set = alloc + len / 2;
-	       }
-	     *set++ = ch;
-	  }
-     }
-   *set = '\0';
-   ungetc(ch, f);
-   return alloc;
-}
-
-/* This structure holds a linked list of file name maps, one per directory. */
-struct file_name_map_list {
-   struct file_name_map_list *map_list_next;
-   char               *map_list_name;
-   struct file_name_map *map_list_map;
-};
-
-/* Read the file name map file for DIRNAME.  */
-
-static struct file_name_map *
-read_name_map(cpp_reader * pfile, const char *dirname)
-{
-   struct file_name_map_list *map_list_ptr;
-   char               *name;
-   FILE               *f;
-
-   for (map_list_ptr = CPP_OPTIONS(pfile)->map_list; map_list_ptr;
-	map_list_ptr = map_list_ptr->map_list_next)
-      if (!strcmp(map_list_ptr->map_list_name, dirname))
-	 return map_list_ptr->map_list_map;
-
-   map_list_ptr =
-      ((struct file_name_map_list *)xmalloc(sizeof(struct file_name_map_list)));
-
-   map_list_ptr->map_list_name = savestring(dirname);
-   map_list_ptr->map_list_map = NULL;
-
-   name = (char *)alloca(strlen(dirname) + strlen(FILE_NAME_MAP_FILE) + 2);
-   strcpy(name, dirname);
-   if (*dirname)
-      strcat(name, "/");
-   strcat(name, FILE_NAME_MAP_FILE);
-   f = fopen(name, "r");
-   if (!f)
-      map_list_ptr->map_list_map = NULL;
-   else
-     {
-	int                 ch;
-	int                 dirlen = strlen(dirname);
-
-	while ((ch = getc(f)) != EOF)
-	  {
-	     char               *from, *to;
-	     struct file_name_map *ptr;
-
-	     if (is_space[ch])
-		continue;
-	     from = read_filename_string(ch, f);
-	     while ((ch = getc(f)) != EOF && is_hor_space[ch]);
-	     to = read_filename_string(ch, f);
-
-	     ptr =
-		((struct file_name_map *)xmalloc(sizeof(struct file_name_map)));
-
-	     ptr->map_from = from;
-
-	     /* Make the real filename absolute.  */
-	     if (*to == '/')
-		ptr->map_to = to;
-	     else
-	       {
-		  ptr->map_to = (char *)xmalloc(dirlen + strlen(to) + 2);
-		  strcpy(ptr->map_to, dirname);
-		  ptr->map_to[dirlen] = '/';
-		  strcpy(ptr->map_to + dirlen + 1, to);
-		  free(to);
-	       }
-
-	     ptr->map_next = map_list_ptr->map_list_map;
-	     map_list_ptr->map_list_map = ptr;
-
-	     while ((ch = getc(f)) != '\n')
-		if (ch == EOF)
-		   break;
-	  }
-	fclose(f);
-     }
-
-   map_list_ptr->map_list_next = CPP_OPTIONS(pfile)->map_list;
-   CPP_OPTIONS(pfile)->map_list = map_list_ptr;
-
-   return map_list_ptr->map_list_map;
-}
-
-/* Try to open include file FILENAME.  SEARCHPTR is the directory
- * being tried from the include file search path.  This function maps
- * filenames on file systems based on information read by
- * read_name_map.  */
-
-static int
-open_include_file(cpp_reader * pfile, char *filename,
-		  file_name_list * searchptr)
-{
-   struct file_name_map *map;
-   const char         *from;
-   const char         *p, *dir;
-
-   if (searchptr && !searchptr->got_name_map)
-     {
-	searchptr->name_map = read_name_map(pfile,
-					    searchptr->fname
-					    ? searchptr->fname : ".");
-	searchptr->got_name_map = 1;
-     }
-   /* First check the mapping for the directory we are using.  */
-   if (searchptr && searchptr->name_map)
-     {
-	from = filename;
-	if (searchptr->fname)
-	   from += strlen(searchptr->fname) + 1;
-	for (map = searchptr->name_map; map; map = map->map_next)
-	  {
-	     if (!strcmp(map->map_from, from))
-	       {
-		  /* Found a match.  */
-		  return open(map->map_to, O_RDONLY, 0666);
-	       }
-	  }
-     }
-   /* Try to find a mapping file for the particular directory we are
-    * looking in.  Thus #include <sys/types.h> will look up sys/types.h
-    * in /usr/include/header.gcc and look up types.h in
-    * /usr/include/sys/header.gcc.  */
-   p = strrchr(filename, '/');
-   if (!p)
-      p = filename;
-   if (searchptr
-       && searchptr->fname
-       && strlen(searchptr->fname) == (unsigned)(p - filename)
-       && !strncmp(searchptr->fname, filename, p - filename))
-     {
-	/* FILENAME is in SEARCHPTR, which we've already checked.  */
-	return open(filename, O_RDONLY, 0666);
-     }
-   if (p == filename)
-     {
-	dir = ".";
-	from = filename;
-     }
-   else
-     {
-	char               *s;
-
-	s = (char *)alloca(p - filename + 1);
-	memcpy(s, filename, p - filename);
-	s[p - filename] = '\0';
-	from = p + 1;
-	dir = s;
-     }
-   for (map = read_name_map(pfile, dir); map; map = map->map_next)
-      if (!strcmp(map->map_from, from))
-	 return open(map->map_to, O_RDONLY, 0666);
-
-   return open(filename, O_RDONLY, 0666);
-}
-
-#else
 
 static int
 open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
@@ -5506,7 +5313,6 @@ open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
    return open(filename, O_RDONLY, 0666);
 }
 
-#endif /* USE_FILE_NAME_MAPS */
 
 /* Process the contents of include file FNAME, already open on descriptor F,
  * with output to OP.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to