aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew A. Schnoor (@Intel) <matthew.schnoor@intel.com>2023-01-23 09:40:48 -0800
committerGitHub <noreply@github.com>2023-01-23 09:40:48 -0800
commit6a02f9780d5d115dc34dac7ad40bf4e95adac83c (patch)
tree7de427c325e55a17ecea71f102a2e3a201ec3e3b
parentaae857d0d05ac65152ed24992a4acd834a0a107c (diff)
parent38165468b7f3f0198960d81bc9f53da567430778 (diff)
downloadmipisyst-6a02f9780d5d115dc34dac7ad40bf4e95adac83c.zip
mipisyst-6a02f9780d5d115dc34dac7ad40bf4e95adac83c.tar.gz
mipisyst-6a02f9780d5d115dc34dac7ad40bf4e95adac83c.tar.bz2
Merge pull request #3 from tedkuo1/init_svh_hdr
Change the static global variable - zero to local variable
-rw-r--r--library/src/mipi_syst_init.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/library/src/mipi_syst_init.c b/library/src/mipi_syst_init.c
index 90ba5a5..9c213a6 100644
--- a/library/src/mipi_syst_init.c
+++ b/library/src/mipi_syst_init.c
@@ -36,6 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Norbert Schulz (Intel Corporation) - Initial API and implementation
*/
+#include <stdlib.h>
#include "mipi_syst.h"
#include "mipi_syst/message.h"
@@ -44,11 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static struct mipi_syst_header syst_hdr = { 0 };
-static union mipi_syst_null_init {
- struct mipi_syst_handle handle;
- struct mipi_syst_header header;
-} zero = { {0} }; /* for initializations */
-
#if !defined(MIPI_SYST_PCFG_ENABLE_DEFAULT_SCATTER_WRITE)
/**
* null-device style default output function
@@ -78,6 +74,7 @@ mipi_syst_init(
mipi_syst_inithook_t pfinit,
const void *init_param)
{
+ struct mipi_syst_header zero_header = {0};
if (0 == header) {
/* No user supplied global state storage,
* use internal default state
@@ -85,7 +82,7 @@ mipi_syst_init(
header = &syst_hdr;
}
- *header = zero.header;
+ *header = zero_header;
header->systh_version = MIPI_SYST_VERSION_CODE;
#if MIPI_SYST_CONFORMANCE_LEVEL > 10
@@ -143,6 +140,7 @@ mipi_syst_init_handle(
const struct mipi_syst_origin *origin,
mipi_syst_u32 fromHeap)
{
+ struct mipi_syst_handle zero_handle = {0};
if ((struct mipi_syst_handle*) 0 == svh)
return svh;
@@ -154,7 +152,7 @@ mipi_syst_init_handle(
header = &syst_hdr;
}
- *svh = zero.handle;
+ *svh = zero_handle;
svh->systh_header = header;
svh->systh_flags.shf_alloc = fromHeap ? 1 : 0;
@@ -183,6 +181,7 @@ mipi_syst_init_handle(
*/
MIPI_SYST_EXPORT void MIPI_SYST_CALLCONV mipi_syst_delete_handle(struct mipi_syst_handle* svh)
{
+ struct mipi_syst_handle zero_handle = {0};
if ((struct mipi_syst_handle*) 0 != svh) {
#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA)
/* call platform handle release hook if defined
@@ -198,7 +197,7 @@ MIPI_SYST_EXPORT void MIPI_SYST_CALLCONV mipi_syst_delete_handle(struct mipi_sys
} else
#endif
{
- *svh = zero.handle;
+ *svh = zero_handle;
}
}
} \ No newline at end of file