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

guillem pushed a commit to branch master
in repository dpkg.

commit 7614571bb8ef84ca6e4b6de4b93a9bcc2ebbef73
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 14 23:55:08 2015 +0100

    libdpkg: Add new dpkg_error_print() function
---
 lib/dpkg/error.c     | 18 ++++++++++++++++++
 lib/dpkg/error.h     |  3 +++
 lib/dpkg/libdpkg.map |  1 +
 3 files changed, 22 insertions(+)

diff --git a/lib/dpkg/error.c b/lib/dpkg/error.c
index e4b2600..da85bcb 100644
--- a/lib/dpkg/error.c
+++ b/lib/dpkg/error.c
@@ -85,6 +85,24 @@ dpkg_put_errno(struct dpkg_error *err, const char *fmt, ...)
 }
 
 void
+dpkg_error_print(struct dpkg_error *err, const char *fmt, ...)
+{
+       va_list args;
+       char *str;
+
+       va_start(args, fmt);
+       m_vasprintf(&str, fmt, args);
+       va_end(args);
+
+       if (err->type == DPKG_MSG_WARN)
+               warning("%s: %s", str, err->str);
+       else
+               ohshit("%s: %s", str, err->str);
+
+       free(str);
+}
+
+void
 dpkg_error_destroy(struct dpkg_error *err)
 {
        err->type = DPKG_MSG_NONE;
diff --git a/lib/dpkg/error.h b/lib/dpkg/error.h
index 08555dc..edac4f7 100644
--- a/lib/dpkg/error.h
+++ b/lib/dpkg/error.h
@@ -52,6 +52,9 @@ int dpkg_put_error(struct dpkg_error *err, const char *fmt, 
...)
 int dpkg_put_errno(struct dpkg_error *err, const char *fmt, ...)
        DPKG_ATTR_PRINTF(2);
 
+void dpkg_error_print(struct dpkg_error *err, const char *fmt, ...)
+       DPKG_ATTR_PRINTF(2);
+
 void dpkg_error_destroy(struct dpkg_error *err);
 
 /** @} */
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index 6fe9385..55a27c2 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -1,6 +1,7 @@
 LIBDPKG_0 {
 global:
        # Error reporting
+       dpkg_error_print;
        dpkg_error_destroy;
 
        # Charset and string functions

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/dpkg/dpkg.git


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to