MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_get_last_error

Function af_get_last_error

src/api/c/error.cpp:19–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <string>
18
19void af_get_last_error(char **str, dim_t *len) {
20 std::string &global_error_string = get_global_error_string();
21 dim_t slen =
22 std::min(MAX_ERR_SIZE, static_cast<int>(global_error_string.size()));
23
24 if (len && slen == 0) {
25 *len = 0;
26 *str = NULL;
27 return;
28 }
29
30 void *halloc_ptr = nullptr;
31 af_alloc_host(&halloc_ptr, sizeof(char) * (slen + 1));
32 memcpy(str, &halloc_ptr, sizeof(void *));
33 global_error_string.copy(*str, slen);
34
35 (*str)[slen] = '\0';
36 global_error_string = std::string("");
37
38 if (len) { *len = slen; }
39}
40
41af_err af_set_enable_stacktrace(int is_enabled) {
42 arrayfire::common::is_stacktrace_enabled() = is_enabled;

Callers 2

TESTFunction · 0.50
arrayFunction · 0.50

Calls 3

af_alloc_hostFunction · 0.70
minFunction · 0.50
copyMethod · 0.45

Tested by

no test coverage detected