消除unreadVariable:移除3处冗余变量初始化

This commit is contained in:
2026-09-01 13:45:02 +08:00
parent 5b569ea390
commit f1d5483a49
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -36,7 +36,7 @@
static int time_sync_open_listener(void) static int time_sync_open_listener(void)
{ {
int retry; int retry;
int s = -1; int s;
for (retry = 0; retry < 5; retry++) { for (retry = 0; retry < 5; retry++) {
s = net_socket(NET_AF_INET, NET_SOCK_STREAM); s = net_socket(NET_AF_INET, NET_SOCK_STREAM);
+1 -1
View File
@@ -91,7 +91,7 @@ size_t ringbuf_peek(const ringbuf_t *rb, uint8_t *data, size_t len)
{ {
size_t n = 0; size_t n = 0;
size_t i = 0; size_t i = 0;
size_t idx = 0; size_t idx;
n = ringbuf_avail(rb); n = ringbuf_avail(rb);
n = (n < len) ? n : len; n = (n < len) ? n : len;
+3 -3
View File
@@ -585,7 +585,7 @@ int gd5f2gq5ue_read_id(uint8_t *p_mid, uint8_t *p_did) {
* 函数说明:自动处理跨页读取;offset+size 越界返回错误 * 函数说明:自动处理跨页读取;offset+size 越界返回错误
*/ */
int gd5f2gq5ue_read(long offset, uint8_t *p_buf, size_t size) { int gd5f2gq5ue_read(long offset, uint8_t *p_buf, size_t size) {
int ret = GD5F_OK; int ret;
if (offset < 0 || (uint32_t)offset + (uint32_t)size > GD5F_TOTAL_SIZE) { if (offset < 0 || (uint32_t)offset + (uint32_t)size > GD5F_TOTAL_SIZE) {
return GD5F_ERROR; return GD5F_ERROR;
@@ -628,7 +628,7 @@ int gd5f2gq5ue_read(long offset, uint8_t *p_buf, size_t size) {
* 函数说明:自动处理跨页写入;offset+size 越界返回错误 * 函数说明:自动处理跨页写入;offset+size 越界返回错误
*/ */
int gd5f2gq5ue_write(long offset, const uint8_t *p_buf, size_t size) { int gd5f2gq5ue_write(long offset, const uint8_t *p_buf, size_t size) {
int ret = GD5F_OK; int ret;
if (offset < 0 || (uint32_t)offset + (uint32_t)size > GD5F_TOTAL_SIZE) { if (offset < 0 || (uint32_t)offset + (uint32_t)size > GD5F_TOTAL_SIZE) {
return GD5F_ERROR; return GD5F_ERROR;
@@ -665,7 +665,7 @@ int gd5f2gq5ue_write(long offset, const uint8_t *p_buf, size_t size) {
* 函数说明:循环擦除 [offset, offset+size) 覆盖的每个块,偏移/长度不对齐返回错误 * 函数说明:循环擦除 [offset, offset+size) 覆盖的每个块,偏移/长度不对齐返回错误
*/ */
int gd5f2gq5ue_erase(long offset, size_t size) { int gd5f2gq5ue_erase(long offset, size_t size) {
int ret = GD5F_OK; int ret;
if (offset % GD5F_BLOCK_SIZE != 0) { if (offset % GD5F_BLOCK_SIZE != 0) {
return GD5F_ERROR; return GD5F_ERROR;