This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=2385d08c1f67e48de86fc0daa504fef572c99e28

commit 2385d08c1f67e48de86fc0daa504fef572c99e28
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Jan 27 05:06:38 2019 +0100

    libdpkg: Add new dpkg_has_error() function
---
 debian/changelog     | 1 +
 lib/dpkg/error.c     | 6 ++++++
 lib/dpkg/error.h     | 4 ++++
 lib/dpkg/libdpkg.map | 1 +
 4 files changed, 12 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index fc3c98946..39aaa0e68 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -46,6 +46,7 @@ dpkg (1.19.5) UNRELEASED; urgency=medium
     - dpkg: Switch to set the default force option from the forceinfos array.
     - libdpkg: New benchmark programs and infrastructure.
     - libdpkg: Add new dpkg_error_move() function.
+    - libdpkg: Add new dpkg_has_error() function.
   * Build system:
     - Check whether this dist is a release, based only on the version format.
       This will avoid having to do a two staged release to get a proper perl
diff --git a/lib/dpkg/error.c b/lib/dpkg/error.c
index 0e88d399a..025c558ac 100644
--- a/lib/dpkg/error.c
+++ b/lib/dpkg/error.c
@@ -45,6 +45,12 @@ dpkg_error_set(struct dpkg_error *err, enum dpkg_msg_type 
type, int syserrno,
        err->str = str.buf;
 }
 
+bool
+dpkg_has_error(struct dpkg_error *err)
+{
+       return err != NULL && err->type != DPKG_MSG_NONE;
+}
+
 int
 dpkg_put_warn(struct dpkg_error *err, const char *fmt, ...)
 {
diff --git a/lib/dpkg/error.h b/lib/dpkg/error.h
index 31f8e4e8f..9fd7ead21 100644
--- a/lib/dpkg/error.h
+++ b/lib/dpkg/error.h
@@ -21,6 +21,8 @@
 #ifndef LIBDPKG_ERROR_H
 #define LIBDPKG_ERROR_H
 
+#include <stdbool.h>
+
 #include <dpkg/macros.h>
 
 DPKG_BEGIN_DECLS
@@ -48,6 +50,8 @@ struct dpkg_error {
 
 #define DPKG_ERROR_OBJECT (struct dpkg_error)DPKG_ERROR_INIT
 
+bool dpkg_has_error(struct dpkg_error *err);
+
 int dpkg_put_warn(struct dpkg_error *err, const char *fmt, ...)
        DPKG_ATTR_PRINTF(2);
 int dpkg_put_error(struct dpkg_error *err, const char *fmt, ...)
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index 13728403f..e30052b0d 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -1,6 +1,7 @@
 LIBDPKG_0 {
 global:
        # Error reporting
+       dpkg_has_error;
        dpkg_put_warn;
        dpkg_put_error;
        dpkg_put_errno;

-- 
Dpkg.Org's dpkg

Reply via email to