From fdce1ea4431cfc32b7015dd1fe1b71b548d26023 Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周日, 24 4月 2016 21:30:36 +0800 Subject: [PATCH] Move free from SCPI_ResultError to SCPI_SystemErrorNextQ to correspond with SCPI_ErrorPop --- libscpi/inc/scpi/config.h | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/libscpi/inc/scpi/config.h b/libscpi/inc/scpi/config.h index 45a9c3c..712b706 100644 --- a/libscpi/inc/scpi/config.h +++ b/libscpi/inc/scpi/config.h @@ -89,6 +89,16 @@ #define USE_USER_ERROR_LIST 0 #endif +#ifndef USE_DEVICE_DEPENDENT_ERROR_INFORMATION +#define USE_DEVICE_DEPENDENT_ERROR_INFORMATION SYSTEM_TYPE +#endif + +#if USE_DEVICE_DEPENDENT_ERROR_INFORMATION +#ifndef USE_MEMORY_ALLOCATION_FREE +#define USE_MEMORY_ALLOCATION_FREE 1 +#endif +#endif + #ifndef USE_COMMAND_TAGS #define USE_COMMAND_TAGS 1 #endif @@ -251,6 +261,25 @@ #define SCPIDEFINE_doubleToStr(v, s, l) snprintf((s), (l), "%.15lg", (v)) #endif +#if USE_DEVICE_DEPENDENT_ERROR_INFORMATION + +#if USE_MEMORY_ALLOCATION_FREE +#include <stdlib.h> +#include <string.h> +#define SCPIDEFINE_DESCRIPTION_MAX_PARTS 2 +#define SCPIDEFINE_strndup(h, s, l) strndup((s), (l)) +#define SCPIDEFINE_free(h, s, r) free((s)) +#else +#define SCPIDEFINE_DESCRIPTION_MAX_PARTS 3 +#define SCPIDEFINE_strndup(h, s, l) scpiheap_strndup((h), (s), (l)) +#define SCPIDEFINE_free(h, s, r) scpiheap_free((h), (s), (r)) +#define SCPIDEFINE_get_parts(h, s, l1, s2, l2) scpiheap_get_parts((h), (s), (l1), (s2), (l2)) +#endif +#else +#define SCPIDEFINE_DESCRIPTION_MAX_PARTS 1 +#define SCPIDEFINE_strdup(h, s, l) NULL +#define SCPIDEFINE_free(h, s, r) +#endif #ifdef __cplusplus } -- Gitblit v1.9.1