scripts/uncrustify: Use 2-spaces indentation for defines too

This commit is contained in:
Marco Trevisan (Treviño)
2025-02-18 20:56:03 +01:00
committed by Marco Trevisan
parent 4dd51f38c7
commit ee73d67765
10 changed files with 90 additions and 81 deletions

View File

@@ -101,11 +101,14 @@ plot_minutiae (unsigned char *rgbdata,
{ {
int i; int i;
#define write_pixel(num) do { \ #define write_pixel(num) \
rgbdata[((num) * 3)] = 0xff; \ do \
rgbdata[((num) * 3) + 1] = 0; \ { \
rgbdata[((num) * 3) + 2] = 0; \ rgbdata[((num) * 3)] = 0xff; \
} while(0) rgbdata[((num) * 3) + 1] = 0; \
rgbdata[((num) * 3) + 2] = 0; \
} \
while(0)
for (i = 0; i < minutiae->len; i++) for (i = 0; i < minutiae->len; i++)
{ {

View File

@@ -196,8 +196,9 @@ struct read_msg_data
static void __read_msg_async (FpDevice *dev, static void __read_msg_async (FpDevice *dev,
struct read_msg_data *udata); struct read_msg_data *udata);
#define READ_MSG_DATA_CB_ERR(dev, udata, error) (udata)->callback (dev, \ #define READ_MSG_DATA_CB_ERR(dev, udata, error) \
READ_MSG_CMD, 0, 0, NULL, 0, (udata)->user_data, error) (udata)->callback (dev, \
READ_MSG_CMD, 0, 0, NULL, 0, (udata)->user_data, error)
static void static void
busy_ack_sent_cb (FpiUsbTransfer *transfer, FpDevice *device, busy_ack_sent_cb (FpiUsbTransfer *transfer, FpDevice *device,

View File

@@ -162,9 +162,9 @@ enum {
/* Dump buffer for debug */ /* Dump buffer for debug */
#define dump_buffer(buf) \ #define dump_buffer(buf) \
fp_dbg ("%02x %02x %02x %02x %02x %02x %02x %02x", \ fp_dbg ("%02x %02x %02x %02x %02x %02x %02x %02x", \
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13] \ buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13] \
) )
/* Callback of asynchronous send */ /* Callback of asynchronous send */
static void static void

View File

@@ -157,7 +157,7 @@ vfs301_proto_generate_0B (int subtype, gssize *len)
} }
#define HEX_TO_INT(c) \ #define HEX_TO_INT(c) \
(((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'A' + 10)) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'A' + 10))
static guint8 * static guint8 *
translate_str (const char **srcL, gssize *len) translate_str (const char **srcL, gssize *len)
@@ -422,15 +422,15 @@ img_process_data (int first_block, FpDeviceVfs301 *dev, const guint8 *buf, int l
/************************** PROTOCOL STUFF ************************************/ /************************** PROTOCOL STUFF ************************************/
#define USB_RECV(from, len) \ #define USB_RECV(from, len) \
usb_recv (dev, from, len, NULL, NULL) usb_recv (dev, from, len, NULL, NULL)
#define USB_SEND(type, subtype) \ #define USB_SEND(type, subtype) \
{ \ { \
const guint8 *data; \ const guint8 *data; \
gssize len; \ gssize len; \
data = vfs301_proto_generate (type, subtype, &len); \ data = vfs301_proto_generate (type, subtype, &len); \
usb_send (dev, data, len, NULL); \ usb_send (dev, data, len, NULL); \
} }
#define RAW_DATA(x) g_memdup2 (x, sizeof (x)), sizeof (x) #define RAW_DATA(x) g_memdup2 (x, sizeof (x)), sizeof (x)
@@ -489,13 +489,13 @@ vfs301_proto_peek_event (FpDeviceVfs301 *dev)
* we will run into timeouts randomly and need to then try again. * we will run into timeouts randomly and need to then try again.
*/ */
#define PARALLEL_RECEIVE(e1, l1, e2, l2) \ #define PARALLEL_RECEIVE(e1, l1, e2, l2) \
{ \ { \
g_autoptr(GError) error = NULL; \ g_autoptr(GError) error = NULL; \
usb_recv (dev, e1, l1, NULL, &error); \ usb_recv (dev, e1, l1, NULL, &error); \
usb_recv (dev, e2, l2, NULL, NULL); \ usb_recv (dev, e2, l2, NULL, NULL); \
if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT)) \ if (g_error_matches (error, G_USB_DEVICE_ERROR, G_USB_DEVICE_ERROR_TIMED_OUT)) \
usb_recv (dev, e1, l1, NULL, NULL); \ usb_recv (dev, e1, l1, NULL, NULL); \
} }
static void static void
vfs301_proto_process_event_cb (FpiUsbTransfer *transfer, vfs301_proto_process_event_cb (FpiUsbTransfer *transfer,

View File

@@ -41,30 +41,30 @@ struct usb_action
}; };
#define SEND(ENDPOINT, COMMAND) \ #define SEND(ENDPOINT, COMMAND) \
{ \ { \
.type = ACTION_SEND, \ .type = ACTION_SEND, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.name = #COMMAND, \ .name = #COMMAND, \
.size = sizeof (COMMAND), \ .size = sizeof (COMMAND), \
.data = COMMAND \ .data = COMMAND \
}, },
#define RECV(ENDPOINT, SIZE) \ #define RECV(ENDPOINT, SIZE) \
{ \ { \
.type = ACTION_RECEIVE, \ .type = ACTION_RECEIVE, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.size = SIZE, \ .size = SIZE, \
.data = NULL \ .data = NULL \
}, },
#define RECV_CHECK(ENDPOINT, SIZE, EXPECTED) \ #define RECV_CHECK(ENDPOINT, SIZE, EXPECTED) \
{ \ { \
.type = ACTION_RECEIVE, \ .type = ACTION_RECEIVE, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.size = SIZE, \ .size = SIZE, \
.data = EXPECTED, \ .data = EXPECTED, \
.correct_reply_size = sizeof (EXPECTED) \ .correct_reply_size = sizeof (EXPECTED) \
}, },
struct usbexchange_data struct usbexchange_data
{ {

View File

@@ -51,39 +51,39 @@ struct usb_action
}; };
#define SEND(ENDPOINT, COMMAND) \ #define SEND(ENDPOINT, COMMAND) \
{ \ { \
.type = ACTION_SEND, \ .type = ACTION_SEND, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.name = #COMMAND, \ .name = #COMMAND, \
.size = sizeof (COMMAND), \ .size = sizeof (COMMAND), \
.data = COMMAND \ .data = COMMAND \
}, },
#define RECV(ENDPOINT, SIZE) \ #define RECV(ENDPOINT, SIZE) \
{ \ { \
.type = ACTION_RECEIVE, \ .type = ACTION_RECEIVE, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.size = SIZE, \ .size = SIZE, \
.data = NULL \ .data = NULL \
}, },
#define RECV_CHECK(ENDPOINT, SIZE, EXPECTED) \ #define RECV_CHECK(ENDPOINT, SIZE, EXPECTED) \
{ \ { \
.type = ACTION_RECEIVE, \ .type = ACTION_RECEIVE, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.size = SIZE, \ .size = SIZE, \
.data = EXPECTED, \ .data = EXPECTED, \
.correct_reply_size = sizeof (EXPECTED) \ .correct_reply_size = sizeof (EXPECTED) \
}, },
#define RECV_CHECK_SIZE(ENDPOINT, SIZE, EXPECTED) \ #define RECV_CHECK_SIZE(ENDPOINT, SIZE, EXPECTED) \
{ \ { \
.type = ACTION_RECEIVE, \ .type = ACTION_RECEIVE, \
.endpoint = ENDPOINT, \ .endpoint = ENDPOINT, \
.size = SIZE, \ .size = SIZE, \
.data = NULL, \ .data = NULL, \
.correct_reply_size = sizeof (EXPECTED) \ .correct_reply_size = sizeof (EXPECTED) \
}, },
struct usbexchange_data struct usbexchange_data
{ {

View File

@@ -29,7 +29,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (FpPrint, fp_print, FP, PRINT, GInitiallyUnowned) G_DECLARE_FINAL_TYPE (FpPrint, fp_print, FP, PRINT, GInitiallyUnowned)
#define FP_FINGER_IS_VALID(finger) \ #define FP_FINGER_IS_VALID(finger) \
((finger) >= FP_FINGER_FIRST && (finger) <= FP_FINGER_LAST) ((finger) >= FP_FINGER_FIRST && (finger) <= FP_FINGER_LAST)
#include "fp-device.h" #include "fp-device.h"

View File

@@ -79,13 +79,16 @@
* *
* Uses fp_err() to print an error if the @condition is true. * Uses fp_err() to print an error if the @condition is true.
*/ */
#define BUG_ON(condition) G_STMT_START \ #define BUG_ON(condition) \
if (condition) { \ G_STMT_START \
char *s; \ if (condition) \
s = g_strconcat ("BUG: (", #condition, ")", NULL); \ { \
fp_err ("%s: %s() %s:%d", s, G_STRFUNC, __FILE__, __LINE__); \ char *s; \
g_free (s); \ s = g_strconcat ("BUG: (", #condition, ")", NULL); \
} G_STMT_END fp_err ("%s: %s() %s:%d", s, G_STRFUNC, __FILE__, __LINE__); \
g_free (s); \
} \
G_STMT_END
/** /**
* BUG: * BUG:

View File

@@ -60,7 +60,7 @@ typedef void (*FpiSsmHandlerCallback)(FpiSsm *ssm,
/* for library and drivers */ /* for library and drivers */
#define fpi_ssm_new(dev, handler, nr_states) \ #define fpi_ssm_new(dev, handler, nr_states) \
fpi_ssm_new_full (dev, handler, nr_states, nr_states, #nr_states) fpi_ssm_new_full (dev, handler, nr_states, nr_states, #nr_states)
FpiSsm *fpi_ssm_new_full (FpDevice *dev, FpiSsm *fpi_ssm_new_full (FpDevice *dev,
FpiSsmHandlerCallback handler, FpiSsmHandlerCallback handler,
int nr_states, int nr_states,

View File

@@ -19,6 +19,7 @@ indent_func_proto_param false
indent_switch_case 0 indent_switch_case 0
indent_case_brace 2 indent_case_brace 2
indent_paren_close 1 indent_paren_close 1
pp_multiline_define_body_indent 2
# spacing # spacing
sp_arith Add sp_arith Add
@@ -114,6 +115,7 @@ nl_create_for_one_liner False
nl_create_while_one_liner False nl_create_while_one_liner False
nl_after_semicolon True nl_after_semicolon True
nl_multi_line_cond true nl_multi_line_cond true
nl_multi_line_define true
# mod # mod
# I'd like these to be remove, but that removes brackets in if { if { foo } }, which i dislike # I'd like these to be remove, but that removes brackets in if { if { foo } }, which i dislike