2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-23 03:18:59 +00:00

Refactor trap_errors to use std::function

This commit is contained in:
Jay Berkenbilt 2021-12-02 08:57:05 -05:00
parent a144363653
commit 1faa21502f

View File

@ -12,6 +12,7 @@
#include <string>
#include <stdexcept>
#include <cstring>
#include <functional>
struct _qpdf_error
{
@ -120,7 +121,8 @@ static void call_check(qpdf_data qpdf)
w.write();
}
static QPDF_ERROR_CODE trap_errors(qpdf_data qpdf, void (*fn)(qpdf_data))
static QPDF_ERROR_CODE trap_errors(
qpdf_data qpdf, std::function<void(qpdf_data)> fn)
{
QPDF_ERROR_CODE status = QPDF_SUCCESS;
try