Minor changes : added the static keyword to some global variables to at least limit their scope to the file

This commit is contained in:
anschrammh 2023-10-03 20:46:38 +02:00
parent dd5ab56bc0
commit 34bf170dee
4 changed files with 35 additions and 18 deletions

View File

@ -69,7 +69,7 @@ typedef enum gadget_bridge_parser_fsm
} gadget_bridge_parser_fsm_e;
/* Internal variable definition */
struct
static struct
{
char buffer[GADGET_BRIDGE_PARSER_BUFFER_SIZE + 1]; // The +1 is for the string termination character.
uint16_t buffer_content_size; // Without counting the string termination character.
@ -86,7 +86,7 @@ struct
.event_data = { .event_type = GADGET_BRIDGE_EVENT_TYPE_NONE},
};
time_t _unix_timestamp = 0;
static time_t _unix_timestamp = 0;
/* Internal function definition */
static const char *_gadget_bridge_toast_type_2_str(gadget_bridge_toast_type_e toast_type);
@ -1334,7 +1334,7 @@ static const char *_gadget_bridge_http_request_method_2_str(gadget_bridge_http_r
}
}
static bool _parser_extract_time(char *start, char *end)
static bool _parser_extract_time(char *start, char *end)
{
*end = '\0';
char *is_valid = NULL;
@ -1347,7 +1347,7 @@ static bool _parser_extract_time(char *start, char *end)
return *is_valid == '\0';
}
static bool _parser_extract_handle(char *start, char *end)
static bool _parser_extract_handle(char *start, char *end)
{
*end = '\0';
char *is_valid = NULL;
@ -1360,7 +1360,7 @@ static bool _parser_extract_handle(char *start, char *end)
return *is_valid == '\0';
}
static bool _parser_extract_uint8_t(char *start, char *end, uint8_t *data)
static bool _parser_extract_uint8_t(char *start, char *end, uint8_t *data)
{
*end = '\0';
char *is_valid = NULL;
@ -1371,7 +1371,7 @@ static bool _parser_extract_uint8_t(char *start, char *end, uint8_t *data)
return *is_valid == '\0';
}
static bool _parser_extract_float(char *start, char *end, float *data)
static bool _parser_extract_float(char *start, char *end, float *data)
{
*end = '\0';
char *is_valid = NULL;
@ -1382,7 +1382,7 @@ static bool _parser_extract_float(char *start, char *end, float *data)
return *is_valid == '\0';
}
static bool _parser_extract_uint16_t(char *start, char *end, uint16_t *data)
static bool _parser_extract_uint16_t(char *start, char *end, uint16_t *data)
{
*end = '\0';
char *is_valid = NULL;

View File

@ -72,7 +72,7 @@ typedef enum gadget_bridge_parser_fsm
} gadget_bridge_parser_fsm_e;
/* Internal variable definition */
struct
static struct
{
char buffer[GADGET_BRIDGE_PARSER_BUFFER_SIZE + 1]; // The +1 is for the string termination character.
uint16_t buffer_content_size; // Without counting the string termination character.
@ -89,7 +89,7 @@ struct
.event_data = { .event_type = GADGET_BRIDGE_EVENT_TYPE_NONE},
};
time_t _unix_timestamp = 0;
static time_t _unix_timestamp = 0;
/* Internal function definition */
static const char *_gadget_bridge_toast_type_2_str(gadget_bridge_toast_type_e toast_type);
@ -1326,7 +1326,7 @@ static const char *_gadget_bridge_http_request_method_2_str(gadget_bridge_http_r
}
}
static bool _parser_extract_time(char *start, char *end)
static bool _parser_extract_time(char *start, char *end)
{
*end = '\0';
char *is_valid = NULL;
@ -1339,7 +1339,7 @@ static bool _parser_extract_time(char *start, char *end)
return *is_valid == '\0';
}
static bool _parser_extract_handle(char *start, char *end)
static bool _parser_extract_handle(char *start, char *end)
{
*end = '\0';
char *is_valid = NULL;
@ -1352,7 +1352,7 @@ static bool _parser_extract_handle(char *start, char *end)
return *is_valid == '\0';
}
static bool _parser_extract_uint8_t(char *start, char *end, uint8_t *data)
static bool _parser_extract_uint8_t(char *start, char *end, uint8_t *data)
{
*end = '\0';
char *is_valid = NULL;
@ -1363,7 +1363,7 @@ static bool _parser_extract_uint8_t(char *start, char *end, uint8_t *data)
return *is_valid == '\0';
}
static bool _parser_extract_float(char *start, char *end, float *data)
static bool _parser_extract_float(char *start, char *end, float *data)
{
*end = '\0';
char *is_valid = NULL;
@ -1374,7 +1374,7 @@ static bool _parser_extract_float(char *start, char *end, float *data)
return *is_valid == '\0';
}
static bool _parser_extract_uint16_t(char *start, char *end, uint16_t *data)
static bool _parser_extract_uint16_t(char *start, char *end, uint16_t *data)
{
*end = '\0';
char *is_valid = NULL;

View File

@ -50,3 +50,20 @@
<stdlib.h>
<string.h>
1696357704 source:d:\users\think\documents\w800_smart_watch\src\gadget_bridge_parser\gadget_bridge.c
"gadget_bridge.h"
<stdio.h>
<stdlib.h>
<string.h>
1695293778 d:\users\think\documents\w800_smart_watch\src\gadget_bridge_parser\gadget_bridge.h
<stdint.h>
<stdbool.h>
<time.h>
1695293778 source:d:\users\think\documents\w800_smart_watch\src\gadget_bridge_parser\main.c
<stdio.h>
<stdlib.h>
<string.h>
"gadget_bridge.h"

View File

@ -7,14 +7,14 @@
<Cursor1 position="11119" topLine="337" />
</Cursor>
</File>
<File name="gadget_bridge.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="gadget_bridge.h" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="61086" topLine="1211" />
<Cursor1 position="4063" topLine="0" />
</Cursor>
</File>
<File name="gadget_bridge.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="gadget_bridge.c" open="1" top="1" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4063" topLine="120" />
<Cursor1 position="2213" topLine="94" />
</Cursor>
</File>
</CodeBlocks_layout_file>