avoid anonymous struct typedefs (#900)

This commit is contained in:
Sergiu Deitsch 2023-02-24 20:15:03 +01:00 committed by GitHub
parent 4ffb2f3c40
commit 88e2cd4eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 13 deletions

View File

@ -46,10 +46,10 @@
_START_GOOGLE_NAMESPACE_ _START_GOOGLE_NAMESPACE_
#if !defined(GLOG_OS_WINDOWS) #if !defined(GLOG_OS_WINDOWS)
typedef struct { struct AbbrevPair {
const char *abbrev; const char *abbrev;
const char *real_name; const char *real_name;
} AbbrevPair; };
// List of operators from Itanium C++ ABI. // List of operators from Itanium C++ ABI.
static const AbbrevPair kOperatorList[] = { static const AbbrevPair kOperatorList[] = {
@ -148,7 +148,7 @@ static const AbbrevPair kSubstitutionList[] = {
}; };
// State needed for demangling. // State needed for demangling.
typedef struct { struct State {
const char *mangled_cur; // Cursor of mangled name. const char *mangled_cur; // Cursor of mangled name.
char *out_cur; // Cursor of output string. char *out_cur; // Cursor of output string.
const char *out_begin; // Beginning of output string. const char *out_begin; // Beginning of output string.
@ -158,7 +158,7 @@ typedef struct {
short nest_level; // For nested names. short nest_level; // For nested names.
bool append; // Append flag. bool append; // Append flag.
bool overflowed; // True if output gets overflowed. bool overflowed; // True if output gets overflowed.
} State; };
// We don't use strlen() in libc since it's not guaranteed to be async // We don't use strlen() in libc since it's not guaranteed to be async
// signal safe. // signal safe.

View File

@ -38,13 +38,12 @@
_START_GOOGLE_NAMESPACE_ _START_GOOGLE_NAMESPACE_
typedef struct { struct trace_arg_t {
void **result; void **result;
int max_depth; int max_depth;
int skip_count; int skip_count;
int count; int count;
} trace_arg_t; };
// Workaround for the malloc() in _Unwind_Backtrace() issue. // Workaround for the malloc() in _Unwind_Backtrace() issue.
static _Unwind_Reason_Code nop_backtrace(struct _Unwind_Context */*uc*/, void */*opq*/) { static _Unwind_Reason_Code nop_backtrace(struct _Unwind_Context */*uc*/, void */*opq*/) {

View File

@ -237,11 +237,10 @@ struct _wdirent {
/* File name */ /* File name */
wchar_t d_name[PATH_MAX+1]; wchar_t d_name[PATH_MAX+1];
}; };
typedef struct _wdirent _wdirent;
struct _WDIR { struct _WDIR {
/* Current directory entry */ /* Current directory entry */
struct _wdirent ent; _wdirent ent;
/* Private file data */ /* Private file data */
WIN32_FIND_DATAW data; WIN32_FIND_DATAW data;
@ -255,7 +254,6 @@ struct _WDIR {
/* Initial directory name */ /* Initial directory name */
wchar_t *patt; wchar_t *patt;
}; };
typedef struct _WDIR _WDIR;
/* Multi-byte character version */ /* Multi-byte character version */
struct dirent { struct dirent {
@ -277,14 +275,11 @@ struct dirent {
/* File name */ /* File name */
char d_name[PATH_MAX+1]; char d_name[PATH_MAX+1];
}; };
typedef struct dirent dirent;
struct DIR { struct DIR {
struct dirent ent; struct dirent ent;
struct _WDIR *wdirp; struct _WDIR *wdirp;
}; };
typedef struct DIR DIR;
/* Dirent functions */ /* Dirent functions */
static DIR *opendir (const char *dirname); static DIR *opendir (const char *dirname);