| | |
| | | |
| | | #include <stdint.h> |
| | | |
| | | #include "scpi/parser.h" |
| | | #include "scpi/ieee488.h" |
| | | #include "scpi/error.h" |
| | | #include <scpi/parser.h> |
| | | #include <scpi/ieee488.h> |
| | | #include <scpi/error.h> |
| | | #include "fifo_private.h" |
| | | #include "scpi/constants.h" |
| | | #include <scpi/constants.h> |
| | | |
| | | #if USE_DEVICE_DEPENDENT_ERROR_INFORMATION |
| | | #define SCPI_ERROR_SETVAL(e, c, i) do { (e)->error_code = (c); (e)->device_dependent_info = (i); } while(0) |
| | |
| | | |
| | | static scpi_bool_t SCPI_ErrorAddInternal(scpi_t * context, int16_t err, char * info, size_t info_len) { |
| | | scpi_error_t error_value; |
| | | char * info_ptr = info ? SCPIDEFINE_strndup(&context->error_info_heap, info, info_len) : NULL; |
| | | /* SCPIDEFINE_strndup is sometimes a dumy that does not reference it's arguments. |
| | | Since info_len is not referenced elsewhere caoing to void prevents unusd argument warnings */ |
| | | (void) info_len; |
| | | char * info_ptr = NULL; |
| | | if (info) { |
| | | info_ptr = SCPIDEFINE_strndup(&context->error_info_heap, info, info_len); |
| | | } |
| | | SCPI_ERROR_SETVAL(&error_value, err, info_ptr); |
| | | if (!fifo_add(&context->error_queue, &error_value)) { |
| | | SCPIDEFINE_free(&context->error_info_heap, error_value.device_dependent_info, true); |