Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi
The _FLASH_STRING class is good, however I would also like to see some more string functionality. For example the strncmp and strcmp would be very good to have. For example to compare string commands received through serialport with constant strings stored in flash.
I have created my own strncmp for a project I am working on, outside the Flash library, see below.
This PULL request is just a in browser - not tested - edited versions of Flash.h/Flash.cpp to give you an Idea. Hope to see something like this in next release of the Flash library.
unsigned int fs_strncmp(_FLASH_STRING fs1, const char *s2, size_t n) {
size_t i;
size_t s2_len = strlen(s2);
if (s2_len < n) {
// s2 too short
return 1;
}
for (i = 0; i < n; i++) {
if (fs1[i] != s2[i]) {
return 1;
}
}
return 0;
}