Not all compilers support struct definition inside an anonymous union

The SunPro compiler does not support struct definitions inside an
anonymous union. This patch moves the struct definition so that both
gcc and SunPro 12.1 compile this without issue.
This commit is contained in:
Cary R 2010-05-13 17:33:47 -07:00 committed by Stephen Williams
parent 1be00e0322
commit d2be4293a3
1 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -73,18 +73,19 @@ char*symbol_table_s::key_strdup_(const char*str)
const unsigned leaf_width = 254;
const unsigned node_width = 508;
struct tree_data_ {
char*key;
symbol_value_t val;
};
struct tree_node_ {
bool leaf_flag;
unsigned count;
struct tree_node_*parent;
union {
struct {
char*key;
symbol_value_t val;
} leaf[leaf_width];
struct tree_node_*child[node_width];
struct tree_data_ leaf[leaf_width];
struct tree_node_ *child[node_width];
};
};