Style: Use trailing commas for enums

The trailing comma is supported in MPW and GCC. It fixes the formatting
issue with clang-format and makes cleaner diffs, so trailing commas have
been added to enums and clang-format has been run over the sources.
This commit is contained in:
Dietrich Epp 2022-04-10 03:51:59 -04:00
parent 75f1908690
commit dd96385d7c
10 changed files with 19 additions and 36 deletions

View File

@ -4,7 +4,6 @@ AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
DerivePointerAlignment: false
IncludeBlocks: Preserve
IncludeCategories:

View File

@ -4,8 +4,7 @@
#include "lib/defs.h"
enum
{
enum {
/* Constants for CR and LF. Note that we should not use '\n' or '\r'
anywhere, because these character constants may have unexpected values on
certain old Mac OS compilers, depending on the compiler settings. In
@ -17,8 +16,7 @@ enum
kCharSubstitute = 63
};
typedef enum
{
typedef enum {
/* Don't translite line breaks. */
kLineBreakKeep,
@ -33,11 +31,7 @@ typedef enum
} LineBreakConversion;
/* Directions that the converter runs in. */
typedef enum
{
kToUTF8,
kFromUTF8
} ConvertDirection;
typedef enum { kToUTF8, kFromUTF8 } ConvertDirection;
/* Get the character map used for the given Mac OS script and region codes.
Return -1 if no known character map exists. */

View File

@ -2,8 +2,7 @@
#include "convert/convert.h"
#include "lib/defs.h"
enum
{
enum {
/* Maximum length of encoded character. */
kMaxEncodedLength = 8,

View File

@ -7,10 +7,9 @@
#include <stdlib.h>
#include <string.h>
enum
{
enum {
kInitialBufSize = 4 * 1024,
kConvertBufferSize = 1024
kConvertBufferSize = 1024,
};
static UInt8 *gBuffer[3];

View File

@ -69,10 +69,9 @@ Basic types
#if __bool_true_false_are_defined
typedef bool Boolean;
#else
enum
{
enum {
false,
true
true,
};
typedef unsigned char Boolean;
#endif
@ -95,8 +94,7 @@ Error codes and error reporting
==============================================================================*/
/* Error codes. */
typedef enum
{
typedef enum {
/* No error. */
kErrorOK,

View File

@ -21,6 +21,6 @@ void Failf(const char *msg, ...) __attribute__((format(printf, 1, 2)));
const char *ErrorDescriptionOrDie(ErrorCode err);
/* Print information about completed tests and return the status code. */
int TestsDone(void );
int TestsDone(void);
#endif

View File

@ -15,21 +15,18 @@ struct Timestamp {
};
#endif
typedef enum
{
typedef enum {
kTypeNotExist,
kTypeFile,
kTypeDirectory
kTypeDirectory,
} FileType;
enum
{
enum {
kLocal,
kRemote
kRemote,
};
enum
{
enum {
/* Maximum length of a filename. This is a Mac OS limitation. */
kFilenameLength = 31,

View File

@ -22,8 +22,7 @@ static int CompareFilename(const FileName *x, const FileName *y)
return 0;
}
enum
{
enum {
/*
Maximum height of a file tree.

View File

@ -7,8 +7,7 @@
/* A reference to a file node by 1-based index, or 0 for none. */
typedef int FileRef;
typedef enum
{
typedef enum {
kNodeBlack,
kNodeRed,
} NodeColor;

View File

@ -8,9 +8,8 @@
#include <stdlib.h>
#include <string.h>
enum
{
kFileCount = 200
enum {
kFileCount = 200,
};
static UInt32 Random(UInt32 state)