libfprint/SOURCES/0146-cleanup-Use-pragma-once-everywhere.patch
2021-09-09 20:12:48 +00:00

471 lines
14 KiB
Diff

From 4a734ad13b63eaa7cdf8205b141be16f36057dce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Mon, 16 Dec 2019 20:50:04 +0100
Subject: [PATCH 146/181] cleanup: Use #pragma once everywhere
Remove legacy header guards, and use compiler newer features.
---
examples/storage.h | 6 +-----
examples/utilities.h | 5 +----
libfprint/drivers/aes1660.h | 5 +----
libfprint/drivers/aes2501.h | 5 +----
libfprint/drivers/aes2550.h | 5 +----
libfprint/drivers/aes2660.h | 5 +----
libfprint/drivers/aeslib.h | 5 +----
libfprint/drivers/elan.h | 5 +----
libfprint/drivers/synaptics/bmkt.h | 5 +----
libfprint/drivers/synaptics/bmkt_message.h | 6 +-----
libfprint/drivers/synaptics/bmkt_response.h | 6 +-----
libfprint/drivers/synaptics/sensor.h | 4 +---
libfprint/drivers/synaptics/synaptics.h | 5 +----
libfprint/drivers/upektc.h | 5 +----
libfprint/drivers/upektc_img.h | 5 +----
libfprint/drivers/vfs5011_proto.h | 5 +----
libfprint/drivers_api.h | 5 +----
libfprint/fpi-assembling.h | 5 +----
libfprint/fpi-byte-reader.h | 5 +----
libfprint/fpi-byte-utils.h | 5 +----
libfprint/fpi-byte-writer.h | 5 +----
libfprint/fpi-log.h | 5 +----
22 files changed, 22 insertions(+), 90 deletions(-)
diff --git a/examples/storage.h b/examples/storage.h
index bcbd009..6c6c220 100644
--- a/examples/storage.h
+++ b/examples/storage.h
@@ -18,9 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __STORAGE_H
-#define __STORAGE_H
-
+#pragma once
int print_data_save (FpPrint *print,
FpFinger finger);
@@ -30,5 +28,3 @@ FpPrint * print_create_template (FpDevice *dev,
FpFinger finger);
gboolean print_image_save (FpPrint *print,
const char *path);
-
-#endif /* __STORAGE_H */
diff --git a/examples/utilities.h b/examples/utilities.h
index 7e436ac..7efad29 100644
--- a/examples/utilities.h
+++ b/examples/utilities.h
@@ -18,11 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __UTILITIES_H
-#define __UTILITIES_H
+#pragma once
FpDevice * discover_device (GPtrArray *devices);
FpFinger finger_chooser (void);
const char * finger_to_string (FpFinger finger);
-
-#endif /* __UTILITIES_H */
diff --git a/libfprint/drivers/aes1660.h b/libfprint/drivers/aes1660.h
index 55a94e2..18e4e0c 100644
--- a/libfprint/drivers/aes1660.h
+++ b/libfprint/drivers/aes1660.h
@@ -18,8 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __AES1660_H
-#define __AES1660_H
+#pragma once
#define AES1660_FRAME_SIZE 0x244
@@ -1986,5 +1985,3 @@ static const unsigned char aes1660_start_imaging_cmd[] = {
0x55, 0x07, 0x00, 0x80, 0x42, 0x00, 0x7f, 0x00, 0x00, 0x14,
0x49, 0x03, 0x00, 0x20, 0x00, 0xc8
};
-
-#endif
diff --git a/libfprint/drivers/aes2501.h b/libfprint/drivers/aes2501.h
index dc802ca..171a672 100644
--- a/libfprint/drivers/aes2501.h
+++ b/libfprint/drivers/aes2501.h
@@ -19,8 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __AES2501_H
-#define __AES2501_H
+#pragma once
enum aes2501_regs {
AES2501_REG_CTRL1 = 0x80,
@@ -172,5 +171,3 @@ enum aes2501_sensor_gain2 {
#define AES2501_SUM_HIGH_THRESH 1000
#define AES2501_SUM_LOW_THRESH 700
-
-#endif /* __AES2501_H */
diff --git a/libfprint/drivers/aes2550.h b/libfprint/drivers/aes2550.h
index 8e4ca17..5f38660 100644
--- a/libfprint/drivers/aes2550.h
+++ b/libfprint/drivers/aes2550.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __AES2550_H
-#define __AES2550_H
+#pragma once
/* Registers bits */
@@ -110,5 +109,3 @@ enum aes2550_cmds {
#define AES2550_HEARTBEAT_MAGIC 0xdb
#define AES2550_EP_IN_BUF_SIZE 8192
-
-#endif
diff --git a/libfprint/drivers/aes2660.h b/libfprint/drivers/aes2660.h
index d59f4be..5427c80 100644
--- a/libfprint/drivers/aes2660.h
+++ b/libfprint/drivers/aes2660.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __AES2660_H
-#define __AES2660_H
+#pragma once
#define AES2660_FRAME_SIZE 0x354
@@ -1960,5 +1959,3 @@ static const unsigned char aes2660_start_imaging_cmd[] = {
0x55, 0x07, 0x00, 0x80, 0x42, 0x00, 0xbf, 0x00, 0x00, 0x18,
0x49, 0x03, 0x00, 0x20, 0x08, 0xc8
};
-
-#endif
diff --git a/libfprint/drivers/aeslib.h b/libfprint/drivers/aeslib.h
index 389b3e5..d3ea370 100644
--- a/libfprint/drivers/aeslib.h
+++ b/libfprint/drivers/aeslib.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __AESLIB_H__
-#define __AESLIB_H__
+#pragma once
#include <fprint.h>
@@ -45,5 +44,3 @@ unsigned char aes_get_pixel (struct fpi_frame_asmbl_ctx *ctx,
struct fpi_frame *frame,
unsigned int x,
unsigned int y);
-
-#endif
diff --git a/libfprint/drivers/elan.h b/libfprint/drivers/elan.h
index 169498a..1fdd820 100644
--- a/libfprint/drivers/elan.h
+++ b/libfprint/drivers/elan.h
@@ -18,8 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __ELAN_H
-#define __ELAN_H
+#pragma once
#include <glib.h>
@@ -224,5 +223,3 @@ static void elan_capture (FpDevice *dev);
static void dev_change_state (FpImageDevice *dev,
FpImageDeviceState state);
-
-#endif
diff --git a/libfprint/drivers/synaptics/bmkt.h b/libfprint/drivers/synaptics/bmkt.h
index 67c48f2..1af6d29 100644
--- a/libfprint/drivers/synaptics/bmkt.h
+++ b/libfprint/drivers/synaptics/bmkt.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _BMKT_H_
-#define _BMKT_H_
+#pragma once
/**< User ID maximum length allowed */
#define BMKT_MAX_USER_ID_LEN 100
@@ -228,5 +227,3 @@ typedef struct bmkt_user_id
#ifdef __cplusplus
}
#endif
-
-#endif /* _BMKT_H_ */
diff --git a/libfprint/drivers/synaptics/bmkt_message.h b/libfprint/drivers/synaptics/bmkt_message.h
index d41e3d2..98d38e4 100644
--- a/libfprint/drivers/synaptics/bmkt_message.h
+++ b/libfprint/drivers/synaptics/bmkt_message.h
@@ -16,10 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#ifndef BMKT_MESSAGE_H_
-#define BMKT_MESSAGE_H_
-
+#pragma once
#define BMKT_MESSAGE_HEADER_ID 0xFE
#define BMKT_MESSAGE_HEADER_LEN (4)
@@ -90,4 +87,3 @@ int bmkt_parse_message_header (uint8_t *resp_buf,
bmkt_msg_resp_t *msg_resp);
int bmkt_parse_message_payload (bmkt_msg_resp_t *msg_resp,
bmkt_response_t *resp);
-#endif /* BMKT_MESSAGE_H_ */
diff --git a/libfprint/drivers/synaptics/bmkt_response.h b/libfprint/drivers/synaptics/bmkt_response.h
index cfd7703..f13ed94 100644
--- a/libfprint/drivers/synaptics/bmkt_response.h
+++ b/libfprint/drivers/synaptics/bmkt_response.h
@@ -17,9 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-#ifndef _BMKT_RESPONSE_H_
-#define _BMKT_RESPONSE_H_
+#pragma once
#include "bmkt.h"
@@ -485,5 +483,3 @@ typedef struct bmkt_response
int complete; /**< Operation completion status 1: complete / 0: not completed */
bmkt_response_data_t response; /**< Operation specific response union */
} bmkt_response_t;
-
-#endif /* _BMKT_RESPONSE_H_ */
diff --git a/libfprint/drivers/synaptics/sensor.h b/libfprint/drivers/synaptics/sensor.h
index 922b1dd..32134fe 100644
--- a/libfprint/drivers/synaptics/sensor.h
+++ b/libfprint/drivers/synaptics/sensor.h
@@ -16,8 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _SENSOR_H_
-#define _SENSOR_H_
+#pragma once
#include "usb_transport.h"
#define BMKT_MAX_PENDING_SESSIONS 2
@@ -84,4 +83,3 @@ int bmkt_sensor_handle_response (bmkt_sensor_t *sensor,
bmkt_msg_resp_t *msg_resp);
int bmkt_sensor_send_async_read_command (bmkt_sensor_t *sensor);
-#endif /* _SENSOR_H_ */
diff --git a/libfprint/drivers/synaptics/synaptics.h b/libfprint/drivers/synaptics/synaptics.h
index cce6be9..37eb362 100644
--- a/libfprint/drivers/synaptics/synaptics.h
+++ b/libfprint/drivers/synaptics/synaptics.h
@@ -16,8 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __synaptics_h__
-#define __synaptics_h__
+#pragma once
#include "fpi-device.h"
#include "fpi-ssm.h"
@@ -126,5 +125,3 @@ struct _FpiDeviceSynaptics
struct syna_enroll_resp_data enroll_resp_data;
syna_state_t state;
};
-
-#endif //__synaptics_h__
diff --git a/libfprint/drivers/upektc.h b/libfprint/drivers/upektc.h
index 7ea919a..a1f9a23 100644
--- a/libfprint/drivers/upektc.h
+++ b/libfprint/drivers/upektc.h
@@ -19,8 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __UPEKTC_H
-#define __UPEKTC_H
+#pragma once
#define UPEKTC_CMD_LEN 0x40
#define IMAGE_WIDTH 208
@@ -1936,5 +1935,3 @@ static const unsigned char scan_cmd[0x40] = {
0x05, 0x90, 0xf6, 0x77, 0x84, 0xf5, 0x2f, 0x01,
0x05, 0x90, 0xf6, 0x00, 0xc8, 0x00, 0xec, 0x00
};
-
-#endif
diff --git a/libfprint/drivers/upektc_img.h b/libfprint/drivers/upektc_img.h
index 9185aa8..3052b65 100644
--- a/libfprint/drivers/upektc_img.h
+++ b/libfprint/drivers/upektc_img.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __UPEKTC_IMG_H
-#define __UPEKTC_IMG_H
+#pragma once
static const unsigned char upek2020_init_1[] = {
'C', 'i', 'a', 'o',
@@ -140,5 +139,3 @@ static const unsigned char upek2020_ack_frame[] = {
0x30,
0xac, 0x5b /* CRC */
};
-
-#endif
diff --git a/libfprint/drivers/vfs5011_proto.h b/libfprint/drivers/vfs5011_proto.h
index f71a10f..5b2f8f4 100644
--- a/libfprint/drivers/vfs5011_proto.h
+++ b/libfprint/drivers/vfs5011_proto.h
@@ -1,5 +1,4 @@
-#ifndef __VFS5011_PROTO_H
-#define __VFS5011_PROTO_H
+#pragma once
#define VFS5011_LINE_SIZE 240
#define VFS5011_IMAGE_WIDTH 160
@@ -6182,5 +6181,3 @@ static unsigned char vfs5011_prepare_04[] = { /* 2903 B */
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
};
-
-#endif
diff --git a/libfprint/drivers_api.h b/libfprint/drivers_api.h
index e8ed900..7476ba7 100644
--- a/libfprint/drivers_api.h
+++ b/libfprint/drivers_api.h
@@ -19,8 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __DRIVERS_API_H__
-#define __DRIVERS_API_H__
+#pragma once
#include "fpi-assembling.h"
#include "fpi-device.h"
@@ -30,5 +29,3 @@
#include "fpi-print.h"
#include "fpi-usb-transfer.h"
#include "fpi-ssm.h"
-
-#endif
diff --git a/libfprint/fpi-assembling.h b/libfprint/fpi-assembling.h
index 77e3c55..295e315 100644
--- a/libfprint/fpi-assembling.h
+++ b/libfprint/fpi-assembling.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __FPI_ASSEMBLING_H__
-#define __FPI_ASSEMBLING_H__
+#pragma once
#include <fprint.h>
@@ -116,5 +115,3 @@ struct fpi_line_asmbl_ctx
FpImage *fpi_assemble_lines (struct fpi_line_asmbl_ctx *ctx,
GSList *lines,
size_t num_lines);
-
-#endif
diff --git a/libfprint/fpi-byte-reader.h b/libfprint/fpi-byte-reader.h
index 0a661c6..4a14ec8 100644
--- a/libfprint/fpi-byte-reader.h
+++ b/libfprint/fpi-byte-reader.h
@@ -19,8 +19,7 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __FPI_BYTE_READER_H__
-#define __FPI_BYTE_READER_H__
+#pragma once
#include <glib.h>
#include "fpi-byte-utils.h"
@@ -676,5 +675,3 @@ fpi_byte_reader_skip_inline (FpiByteReader * reader, guint nbytes)
#endif /* FPI_BYTE_READER_DISABLE_INLINES */
G_END_DECLS
-
-#endif /* __FPI_BYTE_READER_H__ */
diff --git a/libfprint/fpi-byte-utils.h b/libfprint/fpi-byte-utils.h
index 8a99121..52acb20 100644
--- a/libfprint/fpi-byte-utils.h
+++ b/libfprint/fpi-byte-utils.h
@@ -21,9 +21,7 @@
* Boston, MA 02110-1301, USA.
*/
-
-#ifndef __FP_UTILS_H__
-#define __FP_UTILS_H__
+#pragma once
#include <glib.h>
@@ -485,4 +483,3 @@ FP_WRITE_DOUBLE_BE(guint8 *data, gdouble num)
G_END_DECLS
#endif /* __GTK_DOC_IGNORE__ */
-#endif /* __FP_UTILS_H__ */
diff --git a/libfprint/fpi-byte-writer.h b/libfprint/fpi-byte-writer.h
index b15a9a1..ccdaf0b 100644
--- a/libfprint/fpi-byte-writer.h
+++ b/libfprint/fpi-byte-writer.h
@@ -18,8 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __FPI_BYTE_WRITER_H__
-#define __FPI_BYTE_WRITER_H__
+#pragma once
#include "fpi-byte-reader.h"
#include <string.h>
@@ -409,5 +408,3 @@ fpi_byte_writer_fill_inline (FpiByteWriter * writer, guint8 value, guint size)
#endif
G_END_DECLS
-
-#endif /* __FPI_BYTE_WRITER_H__ */
diff --git a/libfprint/fpi-log.h b/libfprint/fpi-log.h
index 8f2f6a1..da61204 100644
--- a/libfprint/fpi-log.h
+++ b/libfprint/fpi-log.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef __FPI_LOG_H__
-#define __FPI_LOG_H__
+#pragma once
/**
* SECTION:fpi-log
@@ -94,5 +93,3 @@
* Same as BUG_ON() but is always true.
*/
#define BUG() BUG_ON (1)
-
-#endif
--
2.24.1