Skip to content

Commit 3cca336

Browse files
flichtenheldcron2
authored andcommitted
Reformat the whole project with clang-format
Done with pre-commit run -a, so the version defined in pre-commit config is used. This also changes the Github workflow so that there is no commit that fails GHA. Change-Id: I2566ad493629e1f5fdfa6f6483b8973463404e3e Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250804151853.10565-1-gert@greenie.muc.de> URL: https://gerrit.openvpn.net/c/openvpn/+/791 Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent c667671 commit 3cca336

File tree

258 files changed

+12052
-15278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+12052
-15278
lines changed

.github/workflows/build.yaml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,26 @@ on:
55
pull_request:
66

77
jobs:
8-
checkuncrustify:
9-
name: "Check code style with Uncrustify"
10-
# Ubuntu 22.04 has uncrustify 0.72_f
11-
runs-on: ubuntu-22.04
8+
clang-format:
9+
name: Check code style with clang-format
10+
runs-on: ubuntu-24.04
1211
steps:
1312
- name: Install dependencies
14-
run: sudo apt update && sudo apt install -y uncrustify
13+
run: |
14+
sudo apt update && sudo apt install -y python3-pip
15+
pip3 install pre-commit
1516
- name: Checkout OpenVPN
1617
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17-
with:
18-
path: openvpn
19-
- name: Show uncrustify version
20-
run: uncrustify --version
21-
- name: Run uncrustify
22-
run: ./dev-tools/reformat-all.sh
23-
working-directory: openvpn
18+
- name: Run clang-format
19+
run: pre-commit run -a --show-diff-on-failure || true
2420
- name: Check for changes
25-
run: git diff --output=uncrustify-changes.patch
26-
working-directory: openvpn
27-
- name: Show changes on standard output
28-
run: git diff
29-
working-directory: openvpn
21+
run: git diff --output=format-changes.patch
3022
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3123
with:
32-
name: uncrustify-changes.patch
33-
path: 'openvpn/uncrustify-changes.patch'
24+
name: format-changes.patch
25+
path: format-changes.patch
3426
- name: Set job status
35-
run: test ! -s uncrustify-changes.patch
36-
working-directory: openvpn
27+
run: test ! -s format-changes.patch
3728

3829
android:
3930
strategy:

include/openvpn-msg.h

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#include <windef.h>
2727
#include <ws2tcpip.h>
2828

29-
typedef enum {
29+
typedef enum
30+
{
3031
msg_acknowledgement,
3132
msg_add_address,
3233
msg_del_address,
@@ -50,36 +51,42 @@ typedef enum {
5051
msg_create_adapter
5152
} message_type_t;
5253

53-
typedef struct {
54+
typedef struct
55+
{
5456
message_type_t type;
5557
size_t size;
5658
int message_id;
5759
} message_header_t;
5860

59-
typedef union {
61+
typedef union
62+
{
6063
struct in_addr ipv4;
6164
struct in6_addr ipv6;
6265
} inet_address_t;
6366

64-
typedef struct {
67+
typedef struct
68+
{
6569
int index;
6670
char name[256];
6771
} interface_t;
6872

69-
typedef enum {
70-
wfp_block_local = 1<<0,
71-
wfp_block_dns = 1<<1
73+
typedef enum
74+
{
75+
wfp_block_local = 1 << 0,
76+
wfp_block_dns = 1 << 1
7277
} wfp_block_flags_t;
7378

74-
typedef struct {
79+
typedef struct
80+
{
7581
message_header_t header;
7682
short family;
7783
inet_address_t address;
7884
int prefix_len;
7985
interface_t iface;
8086
} address_message_t;
8187

82-
typedef struct {
88+
typedef struct
89+
{
8390
message_header_t header;
8491
short family;
8592
inet_address_t prefix;
@@ -89,7 +96,8 @@ typedef struct {
8996
int metric;
9097
} route_message_t;
9198

92-
typedef struct {
99+
typedef struct
100+
{
93101
message_header_t header;
94102
interface_t iface;
95103
char domains[512];
@@ -99,14 +107,16 @@ typedef struct {
99107
} dns_cfg_message_t;
100108

101109

102-
typedef enum {
110+
typedef enum
111+
{
103112
nrpt_dnssec
104113
} nrpt_flags_t;
105114

106-
#define NRPT_ADDR_NUM 8 /* Max. number of addresses */
115+
#define NRPT_ADDR_NUM 8 /* Max. number of addresses */
107116
#define NRPT_ADDR_SIZE 48 /* Max. address strlen + some */
108117
typedef char nrpt_address_t[NRPT_ADDR_SIZE];
109-
typedef struct {
118+
typedef struct
119+
{
110120
message_header_t header;
111121
interface_t iface;
112122
nrpt_address_t addresses[NRPT_ADDR_NUM];
@@ -115,14 +125,16 @@ typedef struct {
115125
nrpt_flags_t flags;
116126
} nrpt_dns_cfg_message_t;
117127

118-
typedef struct {
128+
typedef struct
129+
{
119130
message_header_t header;
120131
interface_t iface;
121132
int addr_len;
122133
inet_address_t addr[4]; /* support up to 4 dns addresses */
123134
} wins_cfg_message_t;
124135

125-
typedef struct {
136+
typedef struct
137+
{
126138
message_header_t header;
127139
interface_t iface;
128140
int disable_nbt;
@@ -134,41 +146,48 @@ typedef struct {
134146

135147
/* TODO: NTP */
136148

137-
typedef struct {
149+
typedef struct
150+
{
138151
message_header_t header;
139152
short family;
140153
interface_t iface;
141154
} flush_neighbors_message_t;
142155

143-
typedef struct {
156+
typedef struct
157+
{
144158
message_header_t header;
145159
int error_number;
146160
} ack_message_t;
147161

148-
typedef struct {
162+
typedef struct
163+
{
149164
message_header_t header;
150165
wfp_block_flags_t flags;
151166
interface_t iface;
152167
} wfp_block_message_t;
153168

154-
typedef struct {
169+
typedef struct
170+
{
155171
message_header_t header;
156172
interface_t iface;
157173
} enable_dhcp_message_t;
158174

159-
typedef struct {
175+
typedef struct
176+
{
160177
message_header_t header;
161178
interface_t iface;
162179
short family;
163180
int mtu;
164181
} set_mtu_message_t;
165182

166-
typedef enum {
183+
typedef enum
184+
{
167185
ADAPTER_TYPE_DCO,
168186
ADAPTER_TYPE_TAP,
169187
} adapter_type_t;
170188

171-
typedef struct {
189+
typedef struct
190+
{
172191
message_header_t header;
173192
adapter_type_t adapter_type;
174193
} create_adapter_message_t;

0 commit comments

Comments
 (0)