[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] Remove an unnecessary argument from insert_fprintf.
From: |
James Youngman |
Subject: |
[PATCH 3/8] Remove an unnecessary argument from insert_fprintf. |
Date: |
Sat, 18 Jun 2011 15:50:56 +0100 |
* find/print.c (insert_fprintf): Eliminate the 'func' argument,
since it is always pref_fprintf.
* find/print.h: Adjust the prototype accordingly.
* find/parser.c (parse_fprintf): Don't pass the func argument to
insert_fprintf.
(parse_printf): Likewise.
---
ChangeLog | 8 ++++++++
find/parser.c | 4 ++--
find/print.c | 5 ++---
find/print.h | 2 +-
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2fbe2e9..f25ea28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-06-18 James Youngman <address@hidden>
+ Remove an unnecessary argument from insert_fprintf.
+ * find/print.c (insert_fprintf): Eliminate the 'func' argument,
+ since it is always pref_fprintf.
+ * find/print.h: Adjust the prototype accordingly.
+ * find/parser.c (parse_fprintf): Don't pass the func argument to
+ insert_fprintf.
+ (parse_printf): Likewise.
+
Add new test for octal and letter escapes in -printf format.
* find/testsuite/test_escapechars.golden: Expected output file.
* find/testsuite/test_escapechars.sh: New test.
diff --git a/find/parser.c b/find/parser.c
index b44ce1f..5ca4e69 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2115,7 +2115,7 @@ parse_printf (const struct parser_table* entry, char
**argv, int *arg_ptr)
{
struct format_val fmt;
open_stdout (&fmt);
- if (insert_fprintf (&fmt, entry, pred_fprintf, format))
+ if (insert_fprintf (&fmt, entry, format))
{
return true;
}
@@ -2142,7 +2142,7 @@ parse_fprintf (const struct parser_table* entry, char
**argv, int *arg_ptr)
open_output_file (filename, &fmt);
saved_argc = *arg_ptr;
- if (insert_fprintf (&fmt, entry, pred_fprintf, format))
+ if (insert_fprintf (&fmt, entry, format))
return true;
}
}
diff --git a/find/print.c b/find/print.c
index a605bcf..52da71d 100644
--- a/find/print.c
+++ b/find/print.c
@@ -198,10 +198,9 @@ make_segment (struct segment **segment,
return &(*segment)->next;
}
-/* XXX: do we need to pass FUNC to this function? */
bool
insert_fprintf (struct format_val *vec,
- const struct parser_table *entry, PRED_FUNC func,
+ const struct parser_table *entry,
const char *format_const)
{
char *format = (char*)format_const; /* XXX: casting away constness */
@@ -210,7 +209,7 @@ insert_fprintf (struct format_val *vec,
struct segment **segmentp; /* Address of current segment. */
struct predicate *our_pred;
- our_pred = insert_primary_withpred (entry, func, format_const);
+ our_pred = insert_primary_withpred (entry, pred_fprintf, format_const);
our_pred->side_effects = our_pred->no_default_print = true;
our_pred->args.printf_vec = *vec;
our_pred->need_type = false;
diff --git a/find/print.h b/find/print.h
index 9408711..4ae0307 100644
--- a/find/print.h
+++ b/find/print.h
@@ -12,5 +12,5 @@ struct segment **make_segment (struct segment **segment,
struct predicate *pred);
bool
insert_fprintf (struct format_val *vec,
- const struct parser_table *entry, PRED_FUNC func,
+ const struct parser_table *entry,
const char *format_const);
--
1.7.2.5
- [PATCH 0/8] Print refactoring, James Youngman, 2011/06/18
- [PATCH 3/8] Remove an unnecessary argument from insert_fprintf.,
James Youngman <=
- [PATCH 5/8] Add a test for find -printf ... %%., James Youngman, 2011/06/18
- [PATCH 7/8] Reserve format specifiers %(, %{ and %[ for future use., James Youngman, 2011/06/18
- [PATCH 6/8] Additional test cases for printf field width, precision and sign., James Youngman, 2011/06/18
- [PATCH 4/8] Add a test for "find -printf \c"., James Youngman, 2011/06/18
- [PATCH 2/8] Add new test for octal and letter escapes in -printf format., James Youngman, 2011/06/18
- [PATCH 1/8] Split find's printf-related code into a new file., James Youngman, 2011/06/18
- [PATCH 8/8] Move the printing code into print.c., James Youngman, 2011/06/18