From ffe56e72611360223559a6bec665289717dc6b11 Mon Sep 17 00:00:00 2001 From: Gregg Date: Thu, 28 Dec 2023 18:11:39 -0600 Subject: [PATCH] Remove include HAP.h from SRP SRP now only requires Utils (for TempBuffer). Also, moved HS_ALLOC definitions into Utils so it can be re-used by others files --- src/HomeSpan.h | 12 ------------ src/SRP.cpp | 1 - src/SRP.h | 12 +----------- src/Utils.h | 4 ++++ 4 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 0a789b3..e3be0a6 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -31,18 +31,6 @@ #error ERROR: HOMESPAN IS ONLY AVAILABLE FOR ESP32 MICROCONTROLLERS! #endif -#if defined(BOARD_HAS_PSRAM) -#define HS_MALLOC ps_malloc -#define HS_CALLOC ps_calloc -#define HS_REALLOC ps_realloc -#define ps_new(X) new(ps_malloc(sizeof(X)))X -#else -#define HS_MALLOC malloc -#define HS_CALLOC calloc -#define HS_REALLOC realloc -#define ps_new(X) new X -#endif - #pragma GCC diagnostic ignored "-Wpmf-conversions" // eliminates warning messages from use of pointers to member functions to detect whether update() and loop() are overridden by user #pragma GCC diagnostic ignored "-Wunused-result" // eliminates warning message regarded unused result from call to crypto_scalarmult_curve25519() diff --git a/src/SRP.cpp b/src/SRP.cpp index a204375..40061d9 100644 --- a/src/SRP.cpp +++ b/src/SRP.cpp @@ -29,7 +29,6 @@ #include #include "SRP.h" -#include "HAP.h" ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// diff --git a/src/SRP.h b/src/SRP.h index 50c3088..e2361fd 100644 --- a/src/SRP.h +++ b/src/SRP.h @@ -31,17 +31,7 @@ #include #include -#if defined(BOARD_HAS_PSRAM) -#define HS_MALLOC ps_malloc -#define HS_CALLOC ps_calloc -#define HS_REALLOC ps_realloc -#define ps_new(X) new(ps_malloc(sizeof(X)))X -#else -#define HS_MALLOC malloc -#define HS_CALLOC calloc -#define HS_REALLOC realloc -#define ps_new(X) new X -#endif +#include "Utils.h" ///////////////////////////////////////////////// // Pair-Setup Code Verification Data and Salt diff --git a/src/Utils.h b/src/Utils.h index 9d64db0..fce5791 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -33,9 +33,13 @@ #if defined(BOARD_HAS_PSRAM) #define HS_MALLOC ps_malloc #define HS_CALLOC ps_calloc +#define HS_REALLOC ps_realloc +#define ps_new(X) new(ps_malloc(sizeof(X)))X #else #define HS_MALLOC malloc #define HS_CALLOC calloc +#define HS_REALLOC realloc +#define ps_new(X) new X #endif namespace Utils {