1 2

[PATCH] Rename *_func_t types to *_func

Cristian Adrián Ontivero
Details
Message ID
<20190130091638.3200-1-cristianontivero@gmail.com>
Download raw message
Patch +11 -11
POSIX reserves the _t suffix, so it's advisable to avoid it.
---
This patch follows from the discussion in:
https://lists.sr.ht/~emersion/mrsh-dev/%3C20190125085755.5290-1-cristianontivero%40gmail.com%3E

 builtin/builtin.c        | 2 +-
 hashtable.c              | 2 +-
 include/builtin.h        | 2 +-
 include/mrsh/hashtable.h | 4 ++--
 include/mrsh/parser.h    | 4 ++--
 include/parser.h         | 4 ++--
 parser/parser.c          | 2 +-
 parser/word.c            | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/builtin/builtin.c b/builtin/builtin.c
index f54e95f..0f0c563 100644
--- a/builtin/builtin.c
+++ b/builtin/builtin.c
@@ -8,7 +8,7 @@
 
 struct builtin {
 	const char *name;
-	mrsh_builtin_func_t func;
+	mrsh_builtin_func func;
 	bool special;
 };
 
diff --git a/hashtable.c b/hashtable.c
index 41e5296..e04d944 100644
--- a/hashtable.c
+++ b/hashtable.c
@@ -106,7 +106,7 @@ void mrsh_hashtable_finish(struct mrsh_hashtable *table) {
 }
 
 void mrsh_hashtable_for_each(struct mrsh_hashtable *table,
-		mrsh_hashtable_iterator_func_t iterator, void *user_data) {
+		mrsh_hashtable_iterator_func iterator, void *user_data) {
 	for (size_t i = 0; i < MRSH_HASHTABLE_BUCKETS; ++i) {
 		struct mrsh_hashtable_entry *entry = table->buckets[i];
 		while (entry != NULL) {
diff --git a/include/builtin.h b/include/builtin.h
index afebdc4..8a848c8 100644
--- a/include/builtin.h
+++ b/include/builtin.h
@@ -3,7 +3,7 @@
 
 struct mrsh_state;
 
-typedef int (*mrsh_builtin_func_t)(struct mrsh_state *state,
+typedef int (*mrsh_builtin_func)(struct mrsh_state *state,
 	int argc, char *argv[]);
 
 void print_escaped(const char *value);
diff --git a/include/mrsh/hashtable.h b/include/mrsh/hashtable.h
index f4d8d71..560f150 100644
--- a/include/mrsh/hashtable.h
+++ b/include/mrsh/hashtable.h
@@ -14,7 +14,7 @@ struct mrsh_hashtable {
 	struct mrsh_hashtable_entry *buckets[MRSH_HASHTABLE_BUCKETS];
 };
 
-typedef void (*mrsh_hashtable_iterator_func_t)(const char *key, void *value,
+typedef void (*mrsh_hashtable_iterator_func)(const char *key, void *value,
 	void *user_data);
 
 void mrsh_hashtable_finish(struct mrsh_hashtable *table);
@@ -28,6 +28,6 @@ void *mrsh_hashtable_del(struct mrsh_hashtable *table, const char *key);
  * do so an any other element.
  */
 void mrsh_hashtable_for_each(struct mrsh_hashtable *table,
-	mrsh_hashtable_iterator_func_t iterator, void *user_data);
+	mrsh_hashtable_iterator_func iterator, void *user_data);
 
 #endif
diff --git a/include/mrsh/parser.h b/include/mrsh/parser.h
index a615919..55a1681 100644
--- a/include/mrsh/parser.h
+++ b/include/mrsh/parser.h
@@ -11,7 +11,7 @@ struct mrsh_buffer;
  * An alias callback. The alias named is given as a parameter and the alias
  * value should be returned. NULL should be returned if the alias doesn't exist.
  */
-typedef const char *(*mrsh_parser_alias_func_t)(const char *name,
+typedef const char *(*mrsh_parser_alias_func)(const char *name,
 	void *user_data);
 
 /**
@@ -53,7 +53,7 @@ bool mrsh_parser_eof(struct mrsh_parser *state);
  * Set the alias callback.
  */
 void mrsh_parser_set_alias_func(struct mrsh_parser *state,
-	mrsh_parser_alias_func_t alias, void *user_data);
+	mrsh_parser_alias_func alias, void *user_data);
 /**
  * Check if the parser ended with a syntax error. The error message is returned.
  * The error position can optionally be obtained.
diff --git a/include/parser.h b/include/parser.h
index 50c4937..81b5390 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -59,11 +59,11 @@ struct mrsh_parser {
 	struct mrsh_array here_documents;
 	bool continuation_line;
 
-	mrsh_parser_alias_func_t alias;
+	mrsh_parser_alias_func alias;
 	void *alias_user_data;
 };
 
-typedef struct mrsh_word *(*word_func_t)(struct mrsh_parser *state, char end);
+typedef struct mrsh_word *(*word_func)(struct mrsh_parser *state, char end);
 
 size_t parser_peek(struct mrsh_parser *state, char *buf, size_t size);
 char parser_peek_char(struct mrsh_parser *state);
diff --git a/parser/parser.c b/parser/parser.c
index 0219c34..57d89b8 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -353,7 +353,7 @@ bool mrsh_parser_eof(struct mrsh_parser *state) {
 }
 
 void mrsh_parser_set_alias_func(struct mrsh_parser *state,
-		mrsh_parser_alias_func_t alias, void *user_data) {
+		mrsh_parser_alias_func alias, void *user_data) {
 	state->alias = alias;
 	state->alias_user_data = user_data;
 }
diff --git a/parser/word.c b/parser/word.c
index 721e5d2..99ab2e2 100644
--- a/parser/word.c
+++ b/parser/word.c
@@ -174,7 +174,7 @@ char *read_token(struct mrsh_parser *state, size_t len,
 }
 
 static struct mrsh_word *word_list(struct mrsh_parser *state, char end,
-		word_func_t f) {
+		word_func f) {
 	struct mrsh_array children = {0};
 
 	while (true) {
-- 
2.20.1
Details
Message ID
<cSc4z2IL3ACSNHsLneixXZmW-XOtyQcAwoBAhp1gWg_qznouzKz5glk2K-aGdDgCCll_qiRcYFmLRxclpurWxW5NFg4rXwkrOTBjU7xtClA=@emersion.fr>
In-Reply-To
<20190130091638.3200-1-cristianontivero@gmail.com> (view parent)
Download raw message
To git.sr.ht:~emersion/mrsh
   7b4f77f..21468df  master -> master

Thanks!