Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler fix for Dangling Pointer issue #2675

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Sming/Wiring/FakePgmSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,3 @@ int memcmp_aligned(const void* ptr1, const void* ptr2, unsigned len)
auto tail2 = pgm_read_dword(reinterpret_cast<const uint8_t*>(ptr2) + len_aligned);
return memcmp(&tail1, &tail2, len - len_aligned);
}

#ifdef ARCH_HOST
char* smg_return_local(char* buf)
{
return buf;
}
#endif
10 changes: 4 additions & 6 deletions Sming/Wiring/FakePgmSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,8 @@ extern "C" {
}))

#ifdef ARCH_HOST
// Internal function to prevent 'dangling pointer' compiler warning
extern char* smg_return_local(char* buf);
#define _F(str) (str)
#else
#define smg_return_local(buf) (buf)
#endif

/**
* @brief Declare and use a flash string inline.
* @param str
Expand All @@ -91,9 +87,11 @@ extern char* smg_return_local(char* buf);
(__extension__({ \
DEFINE_PSTR_LOCAL(__pstr__, str); \
LOAD_PSTR(buf, __pstr__); \
smg_return_local(buf); \
buf; \
}))

#endif

/**
* @brief copy memory aligned to word boundaries
* @param dst
Expand Down
Loading