From fe790f34e676b360a421a427db605a4e325a3535 Mon Sep 17 00:00:00 2001 From: gong-guilin Date: Fri, 8 Aug 2025 18:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gong-guilin --- interfaces/kits/samgr/common.h | 2 +- samgr/source/common.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/interfaces/kits/samgr/common.h b/interfaces/kits/samgr/common.h index adc924c..2be589d 100644 --- a/interfaces/kits/samgr/common.h +++ b/interfaces/kits/samgr/common.h @@ -108,7 +108,7 @@ typedef struct SimpleVector { /** Peak value of the number of stored data records. The initial value is 0. */ int16 top; /** Number of data records that have been released. The initial value is 0. */ - int16 free; + int16 fre; /** Data storage pointer */ void **data; /** diff --git a/samgr/source/common.c b/samgr/source/common.c index cc23a7c..e65d4e9 100644 --- a/samgr/source/common.c +++ b/samgr/source/common.c @@ -34,7 +34,7 @@ void VECTOR_Clear(Vector *vector) SAMGR_Free(vector->data); vector->max = 0; vector->top = 0; - vector->free = 0; + vector->fre = 0; vector->data = NULL; } @@ -50,7 +50,7 @@ int16 VECTOR_Add(Vector *vector, void *element) for (i = vector->top - (int16)1; i >= 0; --i) { if (vector->data[i] == NULL) { vector->data[i] = element; - vector->free--; + vector->fre--; return i; } } @@ -94,7 +94,7 @@ void *VECTOR_Swap(Vector *vector, int16 index, void *element) return NULL; } if (element == NULL) { - vector->free++; + vector->fre++; } void *oldElement = vector->data[index]; vector->data[index] = element; @@ -150,5 +150,5 @@ int16 VECTOR_Num(Vector *vector) if (vector == NULL) { return INVALID_INDEX; } - return vector->top - vector->free; + return vector->top - vector->fre; } -- Gitee