[clinfo] 65/148: Use REPORT_ERROR instead of CHECK_ERROR for non-fatals

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:46 UTC 2014


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

anbe pushed a commit to branch clinfo
in repository clinfo.

commit cc72376dbbf1b7b97c07a4c222632a2dc84c9324
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Mon Sep 22 16:57:32 2014 +0200

    Use REPORT_ERROR instead of CHECK_ERROR for non-fatals
---
 src/error.h  | 12 ++++++++++++
 src/strbuf.h |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/error.h b/src/error.h
index 28a72c5..741342c 100644
--- a/src/error.h
+++ b/src/error.h
@@ -17,5 +17,17 @@ check_ocl_error(cl_int err, const char *what, const char *func, int line)
 	return err != CL_SUCCESS;
 }
 
+int
+report_ocl_error(char *where, size_t sz, cl_int err, const char *what, const char *func, int line)
+{
+	if (err != CL_SUCCESS) {
+		snprintf(where, sz, "<%s:%d: %s : error %d>",
+			func, line, what, err);
+	}
+	return err != CL_SUCCESS;
+}
+
 #define CHECK_ERROR(what) if (check_ocl_error(error, what, __func__, __LINE__)) exit(1)
 
+#define REPORT_ERROR(what) report_ocl_error(strbuf, bufsz, error, what, __func__, __LINE__)
+
diff --git a/src/strbuf.h b/src/strbuf.h
index f4292f7..35dc6b2 100644
--- a/src/strbuf.h
+++ b/src/strbuf.h
@@ -6,13 +6,13 @@ size_t bufsz, nusz;
 
 #define GET_STRING(cmd, param, param_str, ...) do { \
 	error = cmd(__VA_ARGS__, param, 0, NULL, &nusz); \
-	CHECK_ERROR("get " param_str " size"); \
 	if (nusz > bufsz) { \
 		REALLOC(strbuf, nusz, #param); \
 		bufsz = nusz; \
 	} \
+	if (REPORT_ERROR("get " param_str " size")) break; \
 	error = cmd(__VA_ARGS__, param, bufsz, strbuf, 0); \
-	CHECK_ERROR("get " param_str); \
+	REPORT_ERROR("get " param_str); \
 } while (0)
 
 

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



More information about the Pkg-opencl-commits mailing list