[arrayfire] 223/248: CHECK_ARRAYS lets C-API return errors in case of arr = 0
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:54:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.
commit 7aa5911874f5d3914ac5bd6167444806e73bdd69
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Tue Nov 10 14:55:46 2015 -0500
CHECK_ARRAYS lets C-API return errors in case of arr = 0
---
src/api/c/device.cpp | 1 +
src/api/unified/symbol_manager.cpp | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/src/api/c/device.cpp b/src/api/c/device.cpp
index d3ef95b..ee57a08 100644
--- a/src/api/c/device.cpp
+++ b/src/api/c/device.cpp
@@ -45,6 +45,7 @@ af_err af_get_available_backends(int* result)
af_err af_get_backend_id(af_backend *result, const af_array in)
{
try {
+ ARG_ASSERT(1, in != 0);
ArrayInfo info = getInfo(in);
*result = info.getBackendId();
} CATCHALL;
diff --git a/src/api/unified/symbol_manager.cpp b/src/api/unified/symbol_manager.cpp
index 7c650d4..1139f99 100644
--- a/src/api/unified/symbol_manager.cpp
+++ b/src/api/unified/symbol_manager.cpp
@@ -203,6 +203,13 @@ bool checkArray(af_backend activeBackend, af_array a)
// Convert af_array into int to retrieve the backend info.
// See ArrayInfo.hpp for more
af_backend backend = (af_backend)0;
+
+ // This condition is required so that the invalid args tests for unified
+ // backend return the expected error rather than AF_ERR_ARR_BKND_MISMATCH
+ // Since a = 0, does not have a backend specified, it should be a
+ // AF_ERR_ARG instead of AF_ERR_ARR_BKND_MISMATCH
+ if(a == 0) return true;
+
unified::AFSymbolManager::getInstance().call("af_get_backend_id", &backend, a);
return backend == activeBackend;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list