fp-device: Support variadic arguments to error functions
Make possible to generate a formatted message when creating an error from a device, without having save it first.
This commit is contained in:
parent
3b72b925b0
commit
f6559ba8b1
2 changed files with 26 additions and 6 deletions
|
@ -243,9 +243,18 @@ fpi_device_error_new (FpDeviceError error)
|
|||
* and similar calls.
|
||||
*/
|
||||
GError *
|
||||
fpi_device_retry_new_msg (FpDeviceRetry error, const gchar *msg)
|
||||
fpi_device_retry_new_msg (FpDeviceRetry device_error,
|
||||
const gchar *msg,
|
||||
...)
|
||||
{
|
||||
return g_error_new_literal (FP_DEVICE_RETRY, error, msg);
|
||||
GError *error;
|
||||
va_list args;
|
||||
|
||||
va_start (args, msg);
|
||||
error = g_error_new_valist (FP_DEVICE_RETRY, device_error, msg, args);
|
||||
va_end (args);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -257,9 +266,18 @@ fpi_device_retry_new_msg (FpDeviceRetry error, const gchar *msg)
|
|||
* and similar calls.
|
||||
*/
|
||||
GError *
|
||||
fpi_device_error_new_msg (FpDeviceError error, const gchar *msg)
|
||||
fpi_device_error_new_msg (FpDeviceError device_error,
|
||||
const gchar *msg,
|
||||
...)
|
||||
{
|
||||
return g_error_new_literal (FP_DEVICE_ERROR, error, msg);
|
||||
GError *error;
|
||||
va_list args;
|
||||
|
||||
va_start (args, msg);
|
||||
error = g_error_new_valist (FP_DEVICE_ERROR, device_error, msg, args);
|
||||
va_end (args);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -181,9 +181,11 @@ GError * fpi_device_retry_new (FpDeviceRetry error);
|
|||
GError * fpi_device_error_new (FpDeviceError error);
|
||||
|
||||
GError * fpi_device_retry_new_msg (FpDeviceRetry error,
|
||||
const gchar *msg);
|
||||
const gchar *msg,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
GError * fpi_device_error_new_msg (FpDeviceError error,
|
||||
const gchar *msg);
|
||||
const gchar *msg,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
|
||||
guint64 fpi_device_get_driver_data (FpDevice *device);
|
||||
|
||||
|
|
Loading…
Reference in a new issue