See attached patches.   If no objections, I will submit these soon.
From c785979507716d5c12e70a7fd5bf904487de000e Mon Sep 17 00:00:00 2001
From: James Youngman <ja...@youngman.org>
Date: Mon, 13 May 2024 21:27:12 +0100
Subject: [PATCH 1/3] Remove unused predicate field literal_control_chars.
To: findutils-patc...@gnu.org

---
 find/defs.h   |  3 ---
 find/parser.c | 49 -------------------------------------------------
 find/pred.c   |  2 +-
 find/tree.c   |  1 -
 4 files changed, 1 insertion(+), 54 deletions(-)

diff --git a/find/defs.h b/find/defs.h
index 7d7f5e89..b00e5d23 100644
--- a/find/defs.h
+++ b/find/defs.h
@@ -294,9 +294,6 @@ struct predicate
   /* est_success_rate is a number between 0.0 and 1.0 */
   float est_success_rate;
 
-  /* True if this predicate should display control characters literally */
-  bool literal_control_chars;
-
   /* True if this predicate didn't originate from the user. */
   bool artificial;
 
diff --git a/find/parser.c b/find/parser.c
index 8c78d6c2..51bb5c5e 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -157,9 +157,6 @@ static bool parse_warn          (const struct parser_table*, char *argv[], int *
 static bool parse_xtype         (const struct parser_table*, char *argv[], int *arg_ptr);
 static bool parse_quit          (const struct parser_table*, char *argv[], int *arg_ptr);
 static bool parse_context       (const struct parser_table*, char *argv[], int *arg_ptr);
-#if 0
-static bool parse_show_control_chars (const struct parser_table*, char *argv[], int *arg_ptr);
-#endif
 
 static bool parse_help (const struct parser_table* entry, char **argv, int *arg_ptr)
   _GL_ATTRIBUTE_NORETURN;
@@ -305,9 +302,6 @@ static struct parser_table const parse_table[] =
   PARSE_TEST       ("regex",                 regex),	     /* GNU */
   PARSE_POSOPT     ("regextype",             regextype),     /* GNU */
   PARSE_TEST       ("samefile",              samefile),	     /* GNU */
-#if 0
-  PARSE_OPTION     ("show-control-chars",    show_control_chars), /* GNU, 4.3.0+ */
-#endif
   PARSE_TEST       ("size",                  size), /* POSIX */
   PARSE_TEST       ("type",                  type), /* POSIX */
   PARSE_TEST       ("uid",                   uid),	     /* GNU */
@@ -2296,49 +2290,6 @@ parse_samefile (const struct parser_table* entry, char **argv, int *arg_ptr)
   return true;
 }
 
-#if 0
-/* This function is commented out partly because support for it is
- * uneven.
- */
-static bool
-parse_show_control_chars (const struct parser_table* entry,
-			  char **argv,
-			  int *arg_ptr)
-{
-  const char *arg;
-  const char *errmsg = _("The -show-control-chars option takes "
-			 "a single argument which "
-			 "must be 'literal' or 'safe'");
-
-  if ((argv == NULL) || (argv[*arg_ptr] == NULL))
-    {
-      error (EXIT_FAILURE, errno, "%s", errmsg);
-      return false;
-    }
-  else
-    {
-      arg = argv[*arg_ptr];
-
-      if (0 == strcmp ("literal", arg))
-	{
-	  options.literal_control_chars = true;
-	}
-      else if (0 == strcmp ("safe", arg))
-	{
-	  options.literal_control_chars = false;
-	}
-      else
-	{
-	  error (EXIT_FAILURE, errno, "%s", errmsg);
-	  return false;
-	}
-      (*arg_ptr)++;		/* consume the argument. */
-      return true;
-    }
-}
-#endif
-
-
 static bool
 parse_true (const struct parser_table* entry, char **argv, int *arg_ptr)
 {
diff --git a/find/pred.c b/find/pred.c
index 8bdeccc6..148c27dc 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -376,7 +376,7 @@ pred_fls (const char *pathname, struct stat *stat_buf, struct predicate *pred_pt
   list_file (pathname, state.cwd_dir_fd, state.rel_pathname, stat_buf,
 	     options.start_time.tv_sec,
 	     options.output_block_size,
-	     pred_ptr->literal_control_chars, stream);
+	     options.literal_control_chars, stream);
   return true;
 }
 
diff --git a/find/tree.c b/find/tree.c
index b2ad50fd..494aaa4b 100644
--- a/find/tree.c
+++ b/find/tree.c
@@ -1501,7 +1501,6 @@ get_new_pred (const struct parser_table *entry)
   last_pred->need_type = true;
   last_pred->p_cost = NeedsUnknown;
   last_pred->arg_text = "ThisShouldBeSetToSomethingElse";
-  last_pred->literal_control_chars = options.literal_control_chars;
   last_pred->est_success_rate = 1.0;
   init_pred_perf (last_pred);
   return last_pred;
-- 
2.39.2

Reply via email to