|
|
73b847 |
From 555fa2dc485b455faa730406faf57acd4d954197 Mon Sep 17 00:00:00 2001
|
|
|
73b847 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
73b847 |
Date: Mon, 25 Nov 2019 21:22:47 +0100
|
|
|
73b847 |
Subject: [PATCH 023/181] fp-device: Support variadic arguments to error
|
|
|
73b847 |
functions
|
|
|
73b847 |
|
|
|
73b847 |
Make possible to generate a formatted message when creating an error from
|
|
|
73b847 |
a device, without having save it first.
|
|
|
73b847 |
---
|
|
|
73b847 |
libfprint/fp-device.c | 26 ++++++++++++++++++++++----
|
|
|
73b847 |
libfprint/fpi-device.h | 6 ++++--
|
|
|
73b847 |
2 files changed, 26 insertions(+), 6 deletions(-)
|
|
|
73b847 |
|
|
|
73b847 |
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
|
|
|
73b847 |
index 480d5cf..13f1b5a 100644
|
|
|
73b847 |
--- a/libfprint/fp-device.c
|
|
|
73b847 |
+++ b/libfprint/fp-device.c
|
|
|
73b847 |
@@ -243,9 +243,18 @@ fpi_device_error_new (FpDeviceError error)
|
|
|
73b847 |
* and similar calls.
|
|
|
73b847 |
*/
|
|
|
73b847 |
GError *
|
|
|
73b847 |
-fpi_device_retry_new_msg (FpDeviceRetry error, const gchar *msg)
|
|
|
73b847 |
+fpi_device_retry_new_msg (FpDeviceRetry device_error,
|
|
|
73b847 |
+ const gchar *msg,
|
|
|
73b847 |
+ ...)
|
|
|
73b847 |
{
|
|
|
73b847 |
- return g_error_new_literal (FP_DEVICE_RETRY, error, msg);
|
|
|
73b847 |
+ GError *error;
|
|
|
73b847 |
+ va_list args;
|
|
|
73b847 |
+
|
|
|
73b847 |
+ va_start (args, msg);
|
|
|
73b847 |
+ error = g_error_new_valist (FP_DEVICE_RETRY, device_error, msg, args);
|
|
|
73b847 |
+ va_end (args);
|
|
|
73b847 |
+
|
|
|
73b847 |
+ return error;
|
|
|
73b847 |
}
|
|
|
73b847 |
|
|
|
73b847 |
/**
|
|
|
73b847 |
@@ -257,9 +266,18 @@ fpi_device_retry_new_msg (FpDeviceRetry error, const gchar *msg)
|
|
|
73b847 |
* and similar calls.
|
|
|
73b847 |
*/
|
|
|
73b847 |
GError *
|
|
|
73b847 |
-fpi_device_error_new_msg (FpDeviceError error, const gchar *msg)
|
|
|
73b847 |
+fpi_device_error_new_msg (FpDeviceError device_error,
|
|
|
73b847 |
+ const gchar *msg,
|
|
|
73b847 |
+ ...)
|
|
|
73b847 |
{
|
|
|
73b847 |
- return g_error_new_literal (FP_DEVICE_ERROR, error, msg);
|
|
|
73b847 |
+ GError *error;
|
|
|
73b847 |
+ va_list args;
|
|
|
73b847 |
+
|
|
|
73b847 |
+ va_start (args, msg);
|
|
|
73b847 |
+ error = g_error_new_valist (FP_DEVICE_ERROR, device_error, msg, args);
|
|
|
73b847 |
+ va_end (args);
|
|
|
73b847 |
+
|
|
|
73b847 |
+ return error;
|
|
|
73b847 |
}
|
|
|
73b847 |
|
|
|
73b847 |
static gboolean
|
|
|
73b847 |
diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h
|
|
|
73b847 |
index a206798..d83a5a3 100644
|
|
|
73b847 |
--- a/libfprint/fpi-device.h
|
|
|
73b847 |
+++ b/libfprint/fpi-device.h
|
|
|
73b847 |
@@ -181,9 +181,11 @@ GError * fpi_device_retry_new (FpDeviceRetry error);
|
|
|
73b847 |
GError * fpi_device_error_new (FpDeviceError error);
|
|
|
73b847 |
|
|
|
73b847 |
GError * fpi_device_retry_new_msg (FpDeviceRetry error,
|
|
|
73b847 |
- const gchar *msg);
|
|
|
73b847 |
+ const gchar *msg,
|
|
|
73b847 |
+ ...) G_GNUC_PRINTF (2, 3);
|
|
|
73b847 |
GError * fpi_device_error_new_msg (FpDeviceError error,
|
|
|
73b847 |
- const gchar *msg);
|
|
|
73b847 |
+ const gchar *msg,
|
|
|
73b847 |
+ ...) G_GNUC_PRINTF (2, 3);
|
|
|
73b847 |
|
|
|
73b847 |
guint64 fpi_device_get_driver_data (FpDevice *device);
|
|
|
73b847 |
|
|
|
73b847 |
--
|
|
|
73b847 |
2.24.1
|
|
|
73b847 |
|