[PATCH] wmc: Remove the token_t typedef.

Huw Davies huw at codeweavers.com
Tue Oct 26 01:37:07 CDT 2021


This conflicts with a system typedef on macOS brought in
by including sys/sysctl.h in commit 2c1b8153630.

Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 tools/wmc/mcl.c      | 14 +++++++-------
 tools/wmc/mcy.y      | 16 ++++++++--------
 tools/wmc/wmc.h      |  4 ++--
 tools/wmc/wmctypes.h |  4 ++--
 tools/wmc/write.c    |  6 +++---
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/tools/wmc/mcl.c b/tools/wmc/mcl.c
index c0ca4eeba5c..c524871d267 100644
--- a/tools/wmc/mcl.c
+++ b/tools/wmc/mcl.c
@@ -486,18 +486,18 @@ static void newline(void)
 
 static int unisort(const void *p1, const void *p2)
 {
-	return unistricmp(((const token_t *)p1)->name, ((const token_t *)p2)->name);
+	return unistricmp(((const struct token *)p1)->name, ((const struct token *)p2)->name);
 }
 
-static token_t *tokentable = NULL;
+static struct token *tokentable = NULL;
 static int ntokentable = 0;
 
-token_t *lookup_token(const WCHAR *s)
+struct token *lookup_token(const WCHAR *s)
 {
-	token_t tok;
+	struct token tok;
 
 	tok.name = s;
-	return (token_t *)bsearch(&tok, tokentable, ntokentable, sizeof(*tokentable), unisort);
+	return (struct token *)bsearch(&tok, tokentable, ntokentable, sizeof(*tokentable), unisort);
 }
 
 void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alias, int fix)
@@ -513,7 +513,7 @@ void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alia
 	qsort(tokentable, ntokentable, sizeof(*tokentable), unisort);
 }
 
-void get_tokentable(token_t **tab, int *len)
+void get_tokentable(struct token **tab, int *len)
 {
 	assert(tab != NULL);
 	assert(len != NULL);
@@ -624,7 +624,7 @@ int mcy_lex(void)
 
 			if(char_table[ch] & CH_IDENT)
 			{
-				token_t *tok;
+				struct token *tok;
 				while(isisochar(ch) && (char_table[ch] & (CH_IDENT|CH_NUMBER)))
 				{
 					push_unichar(ch);
diff --git a/tools/wmc/mcy.y b/tools/wmc/mcy.y
index 879c46ffc77..2c68438c2c1 100644
--- a/tools/wmc/mcy.y
+++ b/tools/wmc/mcy.y
@@ -86,7 +86,7 @@ static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg);
 static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg);
 static msg_t *complete_msg(msg_t *msg, int id);
 static void add_node(node_e type, void *p);
-static void do_add_token(tok_e type, token_t *tok, const char *code);
+static void do_add_token(tok_e type, struct token *tok, const char *code);
 static void test_id(int id);
 static int check_languages(node_t *head);
 static lan_blk_t *block_messages(node_t *head);
@@ -98,7 +98,7 @@ static cp_xlat_t *find_cpxlat(int lan);
 %union {
 	WCHAR		*str;
 	unsigned	num;
-	token_t		*tok;
+	struct token	*tok;
 	lanmsg_t	*lmp;
 	msg_t		*msg;
 	lan_cp_t	lcp;
@@ -306,7 +306,7 @@ sym	: tSYMNAME '=' tIDENT	{ last_sym = $3; }
 	;
 
 sev	: tSEVERITY '=' token	{
-		token_t *tok = lookup_token($3->name);
+		struct token *tok = lookup_token($3->name);
 		if(!tok)
 			xyyerror("Undefined severityname\n");
 		if(tok->type != tok_severity)
@@ -318,7 +318,7 @@ sev	: tSEVERITY '=' token	{
 	;
 
 fac	: tFACILITY '=' token	{
-		token_t *tok = lookup_token($3->name);
+		struct token *tok = lookup_token($3->name);
 		if(!tok)
 			xyyerror("Undefined facilityname\n");
 		if(tok->type != tok_facility)
@@ -346,7 +346,7 @@ body	: lang setline lines tMSGEND	{ $$ = new_lanmsg(&$1, $3); }
 	 * message to be parsed.
 	 */
 lang	: tLANGUAGE setnl '=' token tNL	{
-		token_t *tok = lookup_token($4->name);
+		struct token *tok = lookup_token($4->name);
 		cp_xlat_t *cpx;
 		if(!tok)
 			xyyerror("Undefined language\n");
@@ -388,7 +388,7 @@ lines	: tLINE		{ $$ = $1; }
 /*----------------------------------------------------------------------
  * Helper rules
  */
-token	: tIDENT	{ $$ = xmalloc(sizeof(token_t)); memset($$,0,sizeof(*$$)); $$->name = $1; }
+token	: tIDENT	{ $$ = xmalloc(sizeof(struct token)); memset($$,0,sizeof(*$$)); $$->name = $1; }
 	| tTOKEN	{ $$ = $1; }
 	;
 
@@ -413,9 +413,9 @@ static WCHAR *merge(WCHAR *s1, WCHAR *s2)
 	return s1;
 }
 
-static void do_add_token(tok_e type, token_t *tok, const char *code)
+static void do_add_token(tok_e type, struct token *tok, const char *code)
 {
-	token_t *tp = lookup_token(tok->name);
+	struct token *tp = lookup_token(tok->name);
 	if(tp)
 	{
 		if(tok->type != type)
diff --git a/tools/wmc/wmc.h b/tools/wmc/wmc.h
index 913c2a9443e..891348ad92d 100644
--- a/tools/wmc/wmc.h
+++ b/tools/wmc/wmc.h
@@ -68,7 +68,7 @@ extern FILE *yyin;
 void set_codepage(int cp);
 
 void add_token(tok_e type, const WCHAR *name, int tok, int cp, const WCHAR *alias, int fix);
-token_t *lookup_token(const WCHAR *s);
-void get_tokentable(token_t **tab, int *len);
+struct token *lookup_token(const WCHAR *s);
+void get_tokentable(struct token **tab, int *len);
 
 #endif
diff --git a/tools/wmc/wmctypes.h b/tools/wmc/wmctypes.h
index 6c9a97c5e68..b0ae24f6029 100644
--- a/tools/wmc/wmctypes.h
+++ b/tools/wmc/wmctypes.h
@@ -48,14 +48,14 @@ typedef enum tok_enum {
 	tok_language
 } tok_e;
 
-typedef struct token {
+struct token {
 	tok_e		type;
 	const WCHAR	*name;		/* Parsed name of token */
 	int		token;		/* Tokenvalue or language code */
 	int		codepage;
 	const WCHAR	*alias; 	/* Alias or filename */
 	int		fixed;		/* Cleared if token may change */
-} token_t;
+};
 
 typedef struct lan_cp {
 	int language;
diff --git a/tools/wmc/write.c b/tools/wmc/write.c
index 69ebf24b6b9..469c55722cb 100644
--- a/tools/wmc/write.c
+++ b/tools/wmc/write.c
@@ -154,7 +154,7 @@ void write_h_file(const char *fname)
 	char *cptr;
 	char *cast;
 	FILE *fp;
-	token_t *ttab;
+	struct token *ttab;
 	int ntab;
 	int i;
 	int once = 0;
@@ -279,7 +279,7 @@ void write_h_file(const char *fname)
 static void write_rcbin(FILE *fp)
 {
 	lan_blk_t *lbp;
-	token_t *ttab;
+	struct token *ttab;
 	int ntab;
 	int i;
 
@@ -456,7 +456,7 @@ static void output_bin_data( lan_blk_t *lbp )
 void write_bin_files(void)
 {
     lan_blk_t *lbp;
-    token_t *ttab;
+    struct token *ttab;
     int ntab;
     int i;
 
-- 
2.23.0




More information about the wine-devel mailing list