-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul D.Smith
committed
Dec 27, 2023
1 parent
d2215fc
commit b7301db
Showing
9 changed files
with
388 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* It is helpful to have a string-with-length structure. Note that the length | ||
* is the length WITHOUT NULL but we always NULL terminate so we can trace | ||
* values. | ||
*/ | ||
typedef struct | ||
{ | ||
uint8_t *value; | ||
size_t length; | ||
} cs_string; | ||
|
||
#define CS_STRING_FREE(X) \ | ||
if ((X.value) != NULL) \ | ||
{ \ | ||
free((X).value); \ | ||
(X).value = NULL; \ | ||
(X).length = 0; \ | ||
} | ||
|
||
#define CS_STRING_MALLOC(DST, LEN) \ | ||
(DST) = malloc(LEN); \ | ||
if ((DST) == NULL) \ | ||
{ \ | ||
ESP_LOGE(TAG, "malloc failed for length: %d", (LEN)); \ | ||
ESP_ERROR_CHECK(ESP_FAIL); \ | ||
} |
Oops, something went wrong.