From ded11f7fb37ff3664f233a7ac38c9f17581cbfd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=95=8F=E6=9D=B0?= Date: Tue, 17 Jun 2025 07:05:30 +0000 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴敏杰 --- interfaces/kits/samgr/common.h | 2 +- samgr/adapter/posix/thread_adapter.c | 4 ++-- samgr/source/common.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/samgr/common.h b/interfaces/kits/samgr/common.h index adc924c..2027c5c 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 vFree; /** Data storage pointer */ void **data; /** diff --git a/samgr/adapter/posix/thread_adapter.c b/samgr/adapter/posix/thread_adapter.c index adf7cb3..ffdd775 100644 --- a/samgr/adapter/posix/thread_adapter.c +++ b/samgr/adapter/posix/thread_adapter.c @@ -80,8 +80,8 @@ ThreadId THREAD_Create(Runnable run, void *argv, const ThreadAttr *attr) pthread_attr_setschedparam(&threadAttr, &sched); (void) pthread_once(&g_localKeyOnce, KeyCreate); pthread_t threadId = 0; - int errno = pthread_create(&threadId, &threadAttr, run, argv); - if (errno != 0) { + int err = pthread_create(&threadId, &threadAttr, run, argv); + if (err != 0) { return NULL; } diff --git a/samgr/source/common.c b/samgr/source/common.c index cc23a7c..e43300c 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->vFree = 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->vFree--; return i; } } @@ -94,7 +94,7 @@ void *VECTOR_Swap(Vector *vector, int16 index, void *element) return NULL; } if (element == NULL) { - vector->free++; + vector->vFree++; } 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->vFree; } -- Gitee