Deuglify use of usb parse commands macro in usbutils.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/usbutils.c b/usbutils.c
index c428b04..eae597f 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -521,12 +521,10 @@ static int next_stat = USB_NOSTAT;
#endif // DO_USB_STATS
/* Create usb_commands array from USB_PARSE_COMMANDS macro in usbutils.h */
-#define USB_ADD_COMMAND(X, Y) Y,
char *usb_commands[] = {
- USB_PARSE_COMMANDS
+ USB_PARSE_COMMANDS(JUMPTABLE)
"Null"
};
-#undef USB_ADD_COMMAND
#ifdef EOL
#undef EOL
diff --git a/usbutils.h b/usbutils.h
index 9f93c2a..f086441 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -261,7 +261,10 @@ struct cg_usb_info {
struct cg_usb_tmo usb_tmo[USB_TMOS];
};
-#define USB_PARSE_COMMANDS \
+#define ENUMERATION(a,b) a,
+#define JUMPTABLE(a,b) b,
+
+#define USB_PARSE_COMMANDS(USB_ADD_COMMAND) \
USB_ADD_COMMAND(C_REJECTED, "RejectedNoDevice") \
USB_ADD_COMMAND(C_PING, "Ping") \
USB_ADD_COMMAND(C_CLEAR, "Clear") \
@@ -339,12 +342,10 @@ struct cg_usb_info {
USB_ADD_COMMAND(C_BF1_IDENTIFY, "BF1Identify")
/* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
-#define USB_ADD_COMMAND(X, Y) X,
enum usb_cmds {
- USB_PARSE_COMMANDS
+ USB_PARSE_COMMANDS(ENUMERATION)
C_MAX
};
-#undef USB_ADD_COMMAND
struct device_drv;
struct cgpu_info;