提交 3d0cb750 编写于 作者: L laiguizhong

修改libbegetutil符号冲突,隐藏不需要暴露的符号

Signed-off-by: Nlaiguizhong <laiguizhong@huawei.com>
Change-Id: I6c42c9188329e875f5f9fcdeeab096a4c5dea202
上级 9b98fd1f
......@@ -45,7 +45,7 @@ struct MountFlags {
unsigned long flags;
};
unsigned int ConvertFlags(char *flagBuffer)
static unsigned int ConvertFlags(char *flagBuffer)
{
static struct FsManagerFlags fsFlags[] = {
{"check", FS_MANAGER_CHECK},
......
......@@ -333,7 +333,7 @@ int MountOneItem(FstabItem *item)
return rc;
}
int CheckRequiredAndMount(FstabItem *item, bool required)
static int CheckRequiredAndMount(FstabItem *item, bool required)
{
int rc = 0;
if (item == NULL) {
......
......@@ -85,7 +85,7 @@ static void hookStageDestroy(ListNode *node)
BEGET_CHECK(node != NULL, return);
stage = (HOOK_STAGE *)node;
ListRemoveAll(&(stage->hooks), NULL);
OH_ListRemoveAll(&(stage->hooks), NULL);
free((void *)stage);
}
......@@ -94,7 +94,7 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou
{
HOOK_STAGE *stageItem;
stageItem = (HOOK_STAGE *)ListFind(&(hookMgr->stages), (void *)(&stage), hookStageCompare);
stageItem = (HOOK_STAGE *)OH_ListFind(&(hookMgr->stages), (void *)(&stage), hookStageCompare);
BEGET_CHECK(stageItem == NULL, return stageItem);
BEGET_CHECK(createIfNotFound, return NULL);
......@@ -103,8 +103,8 @@ static HOOK_STAGE *getHookStage(HOOK_MGR *hookMgr, int stage, int createIfNotFou
stageItem = (HOOK_STAGE *)malloc(sizeof(HOOK_STAGE));
BEGET_CHECK(stageItem != NULL, return NULL);
stageItem->stage = stage;
ListInit(&(stageItem->hooks));
ListAddTail(&(hookMgr->stages), (ListNode *)stageItem);
OH_ListInit(&(stageItem->hooks));
OH_ListAddTail(&(hookMgr->stages), (ListNode *)stageItem);
return stageItem;
}
......@@ -143,7 +143,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void *
// Check if exists
compareVal.prio = prio;
compareVal.hook = hook;
hookItem = (HOOK_ITEM *)ListFind(&(hookStage->hooks), (void *)(&compareVal), hookItemCompareValue);
hookItem = (HOOK_ITEM *)OH_ListFind(&(hookStage->hooks), (void *)(&compareVal), hookItemCompareValue);
BEGET_CHECK(hookItem == NULL, return 0);
// Create new item
......@@ -156,7 +156,7 @@ static int addHookToStage(HOOK_STAGE *hookStage, int prio, OhosHook hook, void *
hookItem->stage = hookStage;
// Insert with order
ListAddWithOrder(&(hookStage->hooks), (ListNode *)hookItem, hookItemCompare);
OH_ListAddWithOrder(&(hookStage->hooks), (ListNode *)hookItem, hookItemCompare);
return 0;
}
......@@ -196,7 +196,7 @@ static int hookTraversalDelProc(ListNode *node, void *cookie)
BEGET_CHECK((void *)hookItem->info.hook == cookie, return 0);
// Remove from the list
ListRemove(node);
OH_ListRemove(node);
// Destroy myself
free((void *)node);
......@@ -220,12 +220,12 @@ void HookMgrDel(HOOK_MGR *hookMgr, int stage, OhosHook hook)
BEGET_CHECK(stageItem != NULL, return);
if (hook != NULL) {
ListTraversal(&(stageItem->hooks), hook, hookTraversalDelProc, 0);
OH_ListTraversal(&(stageItem->hooks), hook, hookTraversalDelProc, 0);
return;
}
// Remove from list
ListRemove((ListNode *)stageItem);
OH_ListRemove((ListNode *)stageItem);
// Destroy stage item
hookStageDestroy((ListNode *)stageItem);
......@@ -279,8 +279,7 @@ int HookMgrExecute(HOOK_MGR *hookMgr, int stage, void *executionContext, const H
args.options = options;
// Traversal all hooks in the specified stage
return ListTraversal(&(stageItem->hooks), (void *)(&args),
hookExecutionProc, flags);
return OH_ListTraversal(&(stageItem->hooks), (void *)(&args), hookExecutionProc, flags);
}
HOOK_MGR *HookMgrCreate(const char *name)
......@@ -296,7 +295,7 @@ HOOK_MGR *HookMgrCreate(const char *name)
free((void *)ret);
return NULL;
}
ListInit(&(ret->stages));
OH_ListInit(&(ret->stages));
return ret;
}
......@@ -305,7 +304,7 @@ void HookMgrDestroy(HOOK_MGR *hookMgr)
hookMgr = getHookMgr(hookMgr, 0);
BEGET_CHECK(hookMgr != NULL, return);
ListRemoveAll(&(hookMgr->stages), hookStageDestroy);
OH_ListRemoveAll(&(hookMgr->stages), hookStageDestroy);
if (hookMgr == defaultHookMgr) {
defaultHookMgr = NULL;
......@@ -336,7 +335,7 @@ static int hookItemTraversal(ListNode *node, void *data)
static int hookStageTraversal(ListNode *node, void *data)
{
HOOK_STAGE *stageItem = (HOOK_STAGE *)node;
ListTraversal(&(stageItem->hooks), data, hookItemTraversal, 0);
OH_ListTraversal(&(stageItem->hooks), data, hookItemTraversal, 0);
return 0;
}
......@@ -355,7 +354,7 @@ void HookMgrTraversal(HOOK_MGR *hookMgr, void *traversalCookie, OhosHookTraversa
// Prepare common args
stageArgs.traversalCookie = traversalCookie;
stageArgs.traversal = traversal;
ListTraversal(&(hookMgr->stages), (void *)(&stageArgs), hookStageTraversal, 0);
OH_ListTraversal(&(hookMgr->stages), (void *)(&stageArgs), hookStageTraversal, 0);
}
/*
......@@ -372,7 +371,7 @@ int HookMgrGetHooksCnt(HOOK_MGR *hookMgr, int stage)
stageItem = getHookStage(hookMgr, stage, false);
BEGET_CHECK(stageItem != NULL, return 0);
return ListGetCnt(&(stageItem->hooks));
return OH_ListGetCnt(&(stageItem->hooks));
}
/*
......@@ -383,5 +382,5 @@ int HookMgrGetStagesCnt(HOOK_MGR *hookMgr)
hookMgr = getHookMgr(hookMgr, 0);
BEGET_CHECK(hookMgr != NULL, return 0);
return ListGetCnt(&(hookMgr->stages));
return OH_ListGetCnt(&(hookMgr->stages));
}
......@@ -48,7 +48,7 @@ MODULE_MGR *ModuleMgrCreate(const char *name)
moduleMgr = (MODULE_MGR *)malloc(sizeof(MODULE_MGR));
BEGET_CHECK(moduleMgr != NULL, return NULL);
ListInit(&(moduleMgr->modules));
OH_ListInit(&(moduleMgr->modules));
moduleMgr->name = strdup(name);
if (moduleMgr->name == NULL) {
free((void *)moduleMgr);
......@@ -154,7 +154,7 @@ int ModuleMgrInstall(MODULE_MGR *moduleMgr, const char *moduleName,
}
// Add to list
ListAddTail(&(moduleMgr->modules), (ListNode *)module);
OH_ListAddTail(&(moduleMgr->modules), (ListNode *)module);
return 0;
}
......@@ -252,16 +252,16 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name)
BEGET_CHECK(moduleMgr != NULL, return);
// Uninstall all modules if no name specified
if (name == NULL) {
ListRemoveAll(&(moduleMgr->modules), moduleDestroy);
OH_ListRemoveAll(&(moduleMgr->modules), moduleDestroy);
return;
}
BEGET_LOGV("ModuleMgrUninstall moduleName %s", name);
// Find module by name
module = (MODULE_ITEM *)ListFind(&(moduleMgr->modules), (void *)name, moduleCompare);
module = (MODULE_ITEM *)OH_ListFind(&(moduleMgr->modules), (void *)name, moduleCompare);
BEGET_ERROR_CHECK(module != NULL, return, "Can not find module %s", name);
// Remove from the list
ListRemove((ListNode *)module);
OH_ListRemove((ListNode *)module);
// Destroy the module
moduleDestroy((ListNode *)module);
}
......@@ -269,7 +269,7 @@ void ModuleMgrUninstall(MODULE_MGR *moduleMgr, const char *name)
int ModuleMgrGetCnt(const MODULE_MGR *moduleMgr)
{
BEGET_CHECK(moduleMgr != NULL, return 0);
return ListGetCnt(&(moduleMgr->modules));
return OH_ListGetCnt(&(moduleMgr->modules));
}
typedef struct tagMODULE_TRAVERSAL_ARGS {
......@@ -312,5 +312,5 @@ void ModuleMgrTraversal(const MODULE_MGR *moduleMgr, void *cookie, OhosModuleTra
args.cookie = cookie;
args.traversal = traversal;
ListTraversal((ListNode *)(&(moduleMgr->modules)), (void *)(&args), moduleTraversalProc, 0);
OH_ListTraversal((ListNode *)(&(moduleMgr->modules)), (void *)(&args), moduleTraversalProc, 0);
}
......@@ -31,7 +31,7 @@
#define DOREBOOT_PARAM "reboot.ut"
#endif
int DoReboot_(const char *option)
static int DoReboot_(const char *option)
{
char value[MAX_REBOOT_OPTION_SIZE];
int ret = 0;
......
......@@ -51,15 +51,15 @@ typedef struct {
typedef void *HashMapHandle;
int HashMapIsEmpty(HashMapHandle handle);
int32_t HashMapCreate(HashMapHandle *handle, const HashInfo *info);
void HashMapDestory(HashMapHandle handle);
int32_t HashMapAdd(HashMapHandle handle, HashNode *hashNode);
void HashMapRemove(HashMapHandle handle, const void *key);
HashNode *HashMapGet(HashMapHandle handle, const void *key);
HashNode *HashMapFind(HashMapHandle handle,
int OH_HashMapIsEmpty(HashMapHandle handle);
int32_t OH_HashMapCreate(HashMapHandle *handle, const HashInfo *info);
void OH_HashMapDestory(HashMapHandle handle);
int32_t OH_HashMapAdd(HashMapHandle handle, HashNode *hashNode);
void OH_HashMapRemove(HashMapHandle handle, const void *key);
HashNode *OH_HashMapGet(HashMapHandle handle, const void *key);
HashNode *OH_HashMapFind(HashMapHandle handle,
int hashCode, const void *key, HashKeyCompare keyCompare);
void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context),
void OH_HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context),
const void *context);
#ifdef __cplusplus
#if __cplusplus
......
......@@ -43,7 +43,7 @@ extern "C" {
* int value;
* } TEST_LIST_ITEM;
*
* 2. Define a list and init list by ListAddTail
* 2. Define a list and init list by OH_ListAddTail
* ListNode testList;
* c(&testList);
*
......@@ -52,7 +52,7 @@ extern "C" {
* item.value = 0;
*
* 4. Add list item to list
* ListAddTail(&testList, (ListNode *)(&item));
* OH_ListAddTail(&testList, (ListNode *)(&item));
*
* 5. Advanced usage: add with order
* // Ordering compare function
......@@ -62,7 +62,7 @@ extern "C" {
* TEST_LIST_ITEM *right = (TEST_LIST_ITEM *)newNode;
* return left->value - right->value;
* }
* ListAddWithOrder(&testList, (ListNode *)(&item))
* OH_ListAddWithOrder(&testList, (ListNode *)(&item))
*/
/**
......@@ -85,7 +85,7 @@ typedef struct ListNode {
* @param head list head, make sure head is valid pointer
* @return None
*/
void ListInit(struct ListNode *list);
void OH_ListInit(struct ListNode *list);
/**
* @brief Add a node to the end of the list
......@@ -94,7 +94,7 @@ void ListInit(struct ListNode *list);
* @param item new node to be added
* @return None
*/
void ListAddTail(struct ListNode *list, struct ListNode *item);
void OH_ListAddTail(struct ListNode *list, struct ListNode *item);
/**
* @brief Remove a node from the list
......@@ -103,7 +103,7 @@ void ListAddTail(struct ListNode *list, struct ListNode *item);
* This function does not free any memory within item.
* @return None
*/
void ListRemove(struct ListNode *item);
void OH_ListRemove(struct ListNode *item);
/**
* @brief ListNode comparison function prototype
......@@ -128,7 +128,7 @@ typedef int (*ListCompareProc)(ListNode *node, ListNode *newNode);
* respectively less than, equal to, or greater than the second.
* @return None
*/
void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc);
void OH_ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc);
/**
* @brief ListNode traversing and find function prototype
......@@ -136,7 +136,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP
* @param node ListNode to be compared.
* @param data value for traversing
* @return
* return 0 if node value equals data for ListFind
* return 0 if node value equals data for OH_ListFind
*/
typedef int (*ListTraversalProc)(ListNode *node, void *data);
......@@ -148,7 +148,7 @@ typedef int (*ListTraversalProc)(ListNode *node, void *data);
* @param compareProc comparing function, return 0 if matched.
* @return the found node; return NULL if none is found.
*/
ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc compareProc);
ListNode *OH_ListFind(const ListNode *head, void *data, ListTraversalProc compareProc);
/* Traversing from end to start */
#define TRAVERSE_REVERSE_ORDER 0x1
......@@ -169,7 +169,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
* @return return -1 for invalid input arguments.
* when TRAVERSE_STOP_WHEN_ERROR is specified, it will return errors from traversalProc
*/
int ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags);
int OH_ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags);
/**
* @brief ListNode destroy function prototype
......@@ -186,7 +186,7 @@ typedef void (*ListDestroyProc)(ListNode *node);
* @param destroyProc destroy function; if NULL, it will free each node by default.
* @return None
*/
void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc);
void OH_ListRemoveAll(ListNode *head, ListDestroyProc destroyProc);
/**
* @brief Get list count
......@@ -194,7 +194,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc);
* @param head list head, make sure head is valid pointer.
* @return the count of nodes in the list; return 0 if error
*/
int ListGetCnt(const ListNode *head);
int OH_ListGetCnt(const ListNode *head);
#ifdef __cplusplus
#if __cplusplus
......
......@@ -99,7 +99,7 @@ static int InitFreeGroupNodes_(InitGroupNode *groupRoot)
while (groupNode != NULL) {
groupRoot = groupNode->next;
if (groupNode->type < NODE_TYPE_GROUPS) { // remove from hashmap
HashMapRemove(g_initWorkspace.hashMap[groupNode->type], groupNode->name);
OH_HashMapRemove(g_initWorkspace.hashMap[groupNode->type], groupNode->name);
}
free(groupNode);
groupNode = groupRoot;
......@@ -173,7 +173,7 @@ void InitServiceSpace(void)
GROUP_HASHMAP_BUCKET
};
for (size_t i = 0; i < ARRAY_LENGTH(g_initWorkspace.hashMap); i++) {
int ret = HashMapCreate(&g_initWorkspace.hashMap[i], &info);
int ret = OH_HashMapCreate(&g_initWorkspace.hashMap[i], &info);
if (ret != 0) {
INIT_LOGE("%s", "Failed to create hash map");
}
......@@ -242,7 +242,7 @@ InitGroupNode *AddGroupNode(int type, const char *name)
g_initWorkspace.groupNodes[type] = groupNode;
if (type < NODE_TYPE_GROUPS) { // add hashmap
HashMapAdd(g_initWorkspace.hashMap[type], &groupNode->hashNode);
OH_HashMapAdd(g_initWorkspace.hashMap[type], &groupNode->hashNode);
}
return groupNode;
}
......@@ -253,7 +253,7 @@ InitGroupNode *GetGroupNode(int type, const char *name)
return NULL;
}
INIT_LOGV("GetGroupNode type %d %p name %s", type, g_initWorkspace.hashMap[type], name);
HashNode *node = HashMapGet(g_initWorkspace.hashMap[type], name);
HashNode *node = OH_HashMapGet(g_initWorkspace.hashMap[type], name);
if (node == NULL) {
return NULL;
}
......@@ -275,7 +275,7 @@ void DelGroupNode(int type, const char *name)
return;
}
INIT_LOGV("DelGroupNode type %d %p name %s", type, g_initWorkspace.hashMap[type], name);
HashMapRemove(g_initWorkspace.hashMap[type], name);
OH_HashMapRemove(g_initWorkspace.hashMap[type], name);
InitGroupNode *groupNode = g_initWorkspace.groupNodes[type];
InitGroupNode *preNode = groupNode;
while (groupNode != NULL) {
......@@ -299,7 +299,7 @@ int CheckNodeValid(int type, const char *name)
if (type >= NODE_TYPE_GROUPS) {
return -1;
}
HashNode *node = HashMapGet(g_initWorkspace.hashMap[type], name);
HashNode *node = OH_HashMapGet(g_initWorkspace.hashMap[type], name);
if (node != NULL) {
INIT_LOGI("Found %s in %s group", name, type == NODE_TYPE_JOBS ? "job" : "service");
return 0;
......
......@@ -43,17 +43,17 @@ int AddCmdExecutor(const char *cmdName, CmdExecutor execCmd)
groupNode->data.cmd = cmd;
cmd->cmdId = g_cmdId++;
cmd->name = groupNode->name;
ListInit(&cmd->cmdExecutor);
OH_ListInit(&cmd->cmdExecutor);
}
if (execCmd == NULL) {
return 0;
}
PluginCmdExecutor *cmdExec = (PluginCmdExecutor *)calloc(1, sizeof(PluginCmdExecutor));
INIT_ERROR_CHECK(cmdExec != NULL, return -1, "Failed to create cmd listener");
ListInit(&cmdExec->node);
OH_ListInit(&cmdExec->node);
cmdExec->id = ++g_cmdExecutorId;
cmdExec->execCmd = execCmd;
ListAddTail(&cmd->cmdExecutor, &cmdExec->node);
OH_ListAddTail(&cmd->cmdExecutor, &cmdExec->node);
return cmdExec->id;
}
......@@ -69,7 +69,7 @@ void RemoveCmdExecutor(const char *cmdName, int id)
while (node != &cmd->cmdExecutor) {
PluginCmdExecutor *cmdExec = ListEntry(node, PluginCmdExecutor, node);
if (cmdExec->id == id) {
ListRemove(&cmdExec->node);
OH_ListRemove(&cmdExec->node);
free(cmdExec);
break;
}
......@@ -148,7 +148,7 @@ void PluginExecCmdByCmdIndex(int index, const char *cmdContent)
{
int hashCode = ((index >> 16) & 0x0000ffff) - 1; // 16 left shift
int cmdId = (index & 0x0000ffff);
HashNode *node = HashMapFind(GetGroupHashMap(NODE_TYPE_CMDS),
HashNode *node = OH_HashMapFind(GetGroupHashMap(NODE_TYPE_CMDS),
hashCode, (const void *)&cmdId, CompareCmdId);
if (node == NULL) {
return;
......
......@@ -68,7 +68,7 @@ static LE_STATUS CreateLoop_(EventLoop **loop, uint32_t maxevents, uint32_t time
TaskNodeFree,
128
};
return HashMapCreate(&(*loop)->taskMap, &info);
return OH_HashMapCreate(&(*loop)->taskMap, &info);
}
LE_STATUS CloseLoop(EventLoop *loop)
......@@ -76,7 +76,7 @@ LE_STATUS CloseLoop(EventLoop *loop)
if (!loop->stop) {
return LE_SUCCESS;
}
HashMapDestory(loop->taskMap);
OH_HashMapDestory(loop->taskMap);
if (loop->close) {
loop->close(loop);
}
......@@ -100,7 +100,7 @@ LE_STATUS ProcessEvent(const EventLoop *loop, int fd, uint32_t oper)
LE_STATUS AddTask(EventLoop *loop, BaseTask *task)
{
LoopMutexLock(&loop->mutex);
HashMapAdd(loop->taskMap, &task->hashNode);
OH_HashMapAdd(loop->taskMap, &task->hashNode);
LoopMutexUnlock(&loop->mutex);
return LE_SUCCESS;
}
......@@ -110,7 +110,7 @@ BaseTask *GetTaskByFd(EventLoop *loop, int fd)
BaseTask *task = NULL;
LoopMutexLock(&loop->mutex);
TaskId id = {0, {fd}};
HashNode *node = HashMapGet(loop->taskMap, &id);
HashNode *node = OH_HashMapGet(loop->taskMap, &id);
if (node != NULL) {
task = HASHMAP_ENTRY(node, BaseTask, hashNode);
}
......@@ -123,7 +123,7 @@ void DelTask(EventLoop *loop, BaseTask *task)
loop->delEvent(loop, task->taskId.fd,
Event_Read | Event_Write | Event_Error | Event_Free | Event_Timeout | Event_Signal);
LoopMutexLock(&loop->mutex);
HashMapRemove(loop->taskMap, (TaskId *)task);
OH_HashMapRemove(loop->taskMap, (TaskId *)task);
LoopMutexUnlock(&loop->mutex);
return;
}
......
......@@ -80,7 +80,7 @@ static int CreatePipeSocket_(const char *server)
return fd;
}
LE_STATUS GetSockaddrFromServer_(const char *server, struct sockaddr_in *addr)
static LE_STATUS GetSockaddrFromServer_(const char *server, struct sockaddr_in *addr)
{
int ret = memset_s(addr, sizeof(struct sockaddr_in), 0, sizeof(struct sockaddr_in));
LE_CHECK(ret == 0, return ret, "Failed to memory set. error: %s", strerror(errno));
......
......@@ -84,7 +84,7 @@ LE_STATUS LE_CreateAsyncTask(const LoopHandle loopHandle,
task->stream.base.handleEvent = HandleAsyncEvent_;
task->stream.base.innerClose = HandleAsyncTaskClose_;
ListInit(&task->stream.buffHead);
OH_ListInit(&task->stream.buffHead);
LoopMutexInit(&task->stream.mutex);
task->processAsyncEvent = processAsyncEvent;
EventLoop *loop = (EventLoop *)loopHandle;
......
......@@ -195,7 +195,7 @@ LE_STATUS LE_CreateStreamClient(const LoopHandle loopHandle,
return LE_NO_MEMORY, "Failed to create task");
task->stream.base.handleEvent = HandleClientEvent_;
task->stream.base.innerClose = HandleStreamTaskClose_;
ListInit(&task->stream.buffHead);
OH_ListInit(&task->stream.buffHead);
LoopMutexInit(&task->stream.mutex);
task->connectComplete = info->connectComplete;
......@@ -229,7 +229,7 @@ LE_STATUS LE_AcceptStreamClient(const LoopHandle loopHandle, const TaskHandle se
task->sendMessageComplete = info->sendMessageComplete;
task->recvMessage = info->recvMessage;
task->serverTask = (StreamServerTask *)server;
ListInit(&task->stream.buffHead);
OH_ListInit(&task->stream.buffHead);
LoopMutexInit(&task->stream.mutex);
if ((info->baseInfo.flags & TASK_TEST) != TASK_TEST) {
EventLoop *loop = (EventLoop *)loopHandle;
......
......@@ -81,7 +81,7 @@ LE_Buffer *CreateBuffer(uint32_t bufferSize)
LE_Buffer *buffer = NULL;
LE_CHECK((buffer = (LE_Buffer *)malloc(sizeof(LE_Buffer) + bufferSize)) != NULL,
return NULL, "Failed to alloc memory for buffer");
ListInit(&buffer->node);
OH_ListInit(&buffer->node);
buffer->buffSize = bufferSize;
buffer->dataSize = 0;
return buffer;
......@@ -110,7 +110,7 @@ LE_Buffer *GetFirstBuffer(StreamTask *task)
void AddBuffer(StreamTask *task, LE_Buffer *buffer)
{
LoopMutexLock(&task->mutex);
ListAddTail(&task->buffHead, &buffer->node);
OH_ListAddTail(&task->buffHead, &buffer->node);
LoopMutexUnlock(&task->mutex);
}
......@@ -141,7 +141,7 @@ void FreeBuffer(const LoopHandle loop, StreamTask *task, LE_Buffer *buffer)
if (CheckTaskFlags((BaseTask *)task, TASK_STREAM | TASK_CONNECT) ||
CheckTaskFlags((BaseTask *)task, TASK_EVENT | TASK_ASYNC_EVENT)) {
LoopMutexLock(&task->mutex);
ListRemove(&buffer->node);
OH_ListRemove(&buffer->node);
LoopMutexUnlock(&task->mutex);
}
free(buffer);
......
......@@ -41,7 +41,7 @@ static ListNode *getBootEventParaList(bool autoCreate)
if (bootEventList == NULL) {
return NULL;
}
ListInit(bootEventList);
OH_ListInit(bootEventList);
return bootEventList;
}
......@@ -77,7 +77,7 @@ static void BootEventParaAdd(const char *paramName)
}
// Add to list
ListAddTail(list, (ListNode *)item);
OH_ListAddTail(list, (ListNode *)item);
}
static int BootEventParaListCompareProc(ListNode *node, void *data)
......@@ -109,15 +109,15 @@ static void BootEventParaFireByName(const char *paramName)
return;
}
found = ListFind(getBootEventParaList(false), (void *)paramName, BootEventParaListCompareProc);
found = OH_ListFind(getBootEventParaList(false), (void *)paramName, BootEventParaListCompareProc);
if (found != NULL) {
// Remove from list
ListRemove(found);
OH_ListRemove(found);
BootEventParaItemDestroy((BOOT_EVENT_PARAM_ITEM *)found);
}
// Check if all boot event params are fired
if (ListGetCnt(getBootEventParaList(false)) > 0) {
if (OH_ListGetCnt(getBootEventParaList(false)) > 0) {
return;
}
......
......@@ -130,10 +130,10 @@ INIT_PUBLIC_API int InitParamWorkSpace(int onlyRead)
WorkSpaceFree,
HASH_BUTT
};
int ret = HashMapCreate(&g_paramWorkSpace.workSpaceHashHandle, &info);
int ret = OH_HashMapCreate(&g_paramWorkSpace.workSpaceHashHandle, &info);
PARAM_CHECK(ret == 0, return -1, "Failed to create hash map for workspace");
WORKSPACE_INIT_LOCK(g_paramWorkSpace);
ListInit(&g_paramWorkSpace.workSpaceList);
OH_ListInit(&g_paramWorkSpace.workSpaceList);
PARAM_SET_FLAG(g_paramWorkSpace.flags, WORKSPACE_FLAGS_INIT);
ret = RegisterSecurityOps(onlyRead);
......@@ -173,7 +173,7 @@ INIT_INNER_API void CloseParamWorkSpace(void)
}
WORKSPACE_RW_LOCK(g_paramWorkSpace);
if (g_paramWorkSpace.workSpaceHashHandle != NULL) {
HashMapDestory(g_paramWorkSpace.workSpaceHashHandle);
OH_HashMapDestory(g_paramWorkSpace.workSpaceHashHandle);
g_paramWorkSpace.workSpaceHashHandle = NULL;
}
WORKSPACE_RW_UNLOCK(g_paramWorkSpace);
......@@ -198,7 +198,7 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi
const char *realName = WORKSPACE_NAME_NORMAL;
#endif
WORKSPACE_RW_LOCK(g_paramWorkSpace);
HashNode *node = HashMapGet(g_paramWorkSpace.workSpaceHashHandle, (const void *)realName);
HashNode *node = OH_HashMapGet(g_paramWorkSpace.workSpaceHashHandle, (const void *)realName);
if (node != NULL) {
WORKSPACE_RW_UNLOCK(g_paramWorkSpace);
return 0;
......@@ -212,17 +212,17 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi
PARAM_CHECK(workSpace != NULL, break, "Failed to create workspace for %s", realName);
workSpace->flags = 0;
workSpace->area = NULL;
ListInit(&workSpace->node);
OH_ListInit(&workSpace->node);
ret = ParamStrCpy(workSpace->fileName, size, realName);
PARAM_CHECK(ret == 0, break, "Failed to copy file name %s", realName);
HASHMAPInitNode(&workSpace->hashNode);
ret = InitWorkSpace(workSpace, onlyRead, spaceSize);
PARAM_CHECK(ret == 0, break, "Failed to init workspace %s", realName);
ret = HashMapAdd(g_paramWorkSpace.workSpaceHashHandle, &workSpace->hashNode);
ret = OH_HashMapAdd(g_paramWorkSpace.workSpaceHashHandle, &workSpace->hashNode);
PARAM_CHECK(ret == 0, CloseWorkSpace(workSpace);
workSpace = NULL;
break, "Failed to add hash node");
ListAddTail(&g_paramWorkSpace.workSpaceList, &workSpace->node);
OH_ListAddTail(&g_paramWorkSpace.workSpaceList, &workSpace->node);
ret = 0;
workSpace = NULL;
} while (0);
......
......@@ -34,7 +34,7 @@ INIT_LOCAL_API WorkSpace *GetWorkSpace(const char *name)
#endif
WorkSpace *space = NULL;
WORKSPACE_RD_LOCK(*paramSpace);
HashNode *node = HashMapGet(paramSpace->workSpaceHashHandle, (const void *)tmpName);
HashNode *node = OH_HashMapGet(paramSpace->workSpaceHashHandle, (const void *)tmpName);
if (node != NULL) {
space = HASHMAP_ENTRY(node, WorkSpace, hashNode);
}
......@@ -63,7 +63,7 @@ INIT_LOCAL_API ParamTrieNode *GetTrieNodeByHandle(ParamHandle handle)
int hashCode = ((handle >> 24) & 0x000000ff); // 24 left shift
uint32_t index = handle & 0x00ffffff;
WORKSPACE_RD_LOCK(*paramSpace);
HashNode *node = HashMapFind(paramSpace->workSpaceHashHandle, hashCode, (const void *)&index, CompareIndex);
HashNode *node = OH_HashMapFind(paramSpace->workSpaceHashHandle, hashCode, (const void *)&index, CompareIndex);
if (node == NULL) {
WORKSPACE_RW_UNLOCK(*paramSpace);
PARAM_LOGV("Failed to get workspace for 0x%x index %d hashCode %d", handle, index, hashCode);
......
......@@ -124,7 +124,7 @@ INIT_LOCAL_API void CloseWorkSpace(WorkSpace *workSpace)
free(workSpace);
return;
}
ListRemove(&workSpace->node);
OH_ListRemove(&workSpace->node);
PARAM_CHECK(workSpace->area != NULL, return, "The workspace area is null");
#ifdef WORKSPACE_AREA_NEED_MUTEX
ParamRWMutexDelete(&workSpace->rwlock);
......
......@@ -240,16 +240,16 @@ static int32_t AddWatchNode(struct tagTriggerNode_ *trigger, const struct Trigge
PARAM_CHECK(watcher != NULL, return -1, "Failed to get param watcher data");
if (extInfo->type == TRIGGER_PARAM_WAIT) {
WaitNode *node = (WaitNode *)trigger;
ListInit(&node->item);
OH_ListInit(&node->item);
node->timeout = extInfo->info.waitInfo.timeout;
node->stream = extInfo->stream;
node->waitId = extInfo->info.waitInfo.waitId;
ListAddTail(&watcher->triggerHead, &node->item);
OH_ListAddTail(&watcher->triggerHead, &node->item);
} else {
WatchNode *node = (WatchNode *)trigger;
ListInit(&node->item);
OH_ListInit(&node->item);
node->watchId = extInfo->info.watchInfo.watchId;
ListAddTail(&watcher->triggerHead, &node->item);
OH_ListAddTail(&watcher->triggerHead, &node->item);
}
return 0;
}
......@@ -401,7 +401,7 @@ PARAM_STATIC int OnIncomingConnect(LoopHandle loop, TaskHandle server)
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != NULL, return -1, "Failed to get watcher");
ListInit(&watcher->triggerHead);
OH_ListInit(&watcher->triggerHead);
watcher->stream = client;
#ifdef STARTUP_INIT_TEST
g_paramService.watcherTask = client;
......
......@@ -93,8 +93,8 @@ static TriggerNode *AddTriggerNode_(TriggerHeader *triggerHead,
return NULL, "Failed to copy conditition");
node->type = type;
node->flags = 0;
ListInit(&node->node);
ListAddTail(&triggerHead->triggerList, &node->node);
OH_ListInit(&node->node);
OH_ListAddTail(&triggerHead->triggerList, &node->node);
triggerHead->triggerCount++;
return node;
}
......@@ -106,7 +106,7 @@ static int32_t AddJobNode_(TriggerNode *trigger, const TriggerExtInfo *extInfo)
PARAM_CHECK(ret == EOK, return -1, "Failed to copy name for trigger");
node->firstCmd = NULL;
node->lastCmd = NULL;
ret = HashMapAdd(GetTriggerWorkSpace()->hashMap, &node->hashNode);
ret = OH_HashMapAdd(GetTriggerWorkSpace()->hashMap, &node->hashNode);
PARAM_CHECK(ret == 0, return -1, "Failed to add hash node");
return 0;
}
......@@ -153,9 +153,9 @@ static void DelJobTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *trigg
}
jobNode->lastCmd = NULL;
jobNode->firstCmd = NULL;
ListRemove(&trigger->node);
OH_ListRemove(&trigger->node);
triggerHead->triggerCount--;
HashMapRemove(workSpace->hashMap, jobNode->name);
OH_HashMapRemove(workSpace->hashMap, jobNode->name);
if (!TRIGGER_IN_QUEUE(trigger)) {
free(jobNode);
......@@ -203,13 +203,13 @@ static void DelWatchTrigger_(const TriggerWorkSpace *workSpace, TriggerNode *tri
PARAM_CHECK(workSpace != NULL, return, "Param is null");
TriggerHeader *triggerHead = GetTriggerHeader(workSpace, trigger->type);
PARAM_CHECK(triggerHead != NULL, return, "Failed to get header %d", trigger->type);
ListRemove(&trigger->node);
OH_ListRemove(&trigger->node);
if (trigger->type == TRIGGER_PARAM_WAIT) {
WaitNode *node = (WaitNode *)trigger;
ListRemove(&node->item);
OH_ListRemove(&node->item);
} else if (trigger->type == TRIGGER_PARAM_WATCH) {
WatchNode *node = (WatchNode *)trigger;
ListRemove(&node->item);
OH_ListRemove(&node->item);
}
PARAM_LOGV("DelWatchTrigger_ %s count %d", GetTriggerName(trigger), triggerHead->triggerCount);
triggerHead->triggerCount--;
......@@ -285,7 +285,7 @@ JobNode *UpdateJobTrigger(const TriggerWorkSpace *workSpace,
JobNode *GetTriggerByName(const TriggerWorkSpace *workSpace, const char *triggerName)
{
PARAM_CHECK(workSpace != NULL && triggerName != NULL, return NULL, "Invalid param");
HashNode *node = HashMapGet(workSpace->hashMap, triggerName);
HashNode *node = OH_HashMapGet(workSpace->hashMap, triggerName);
if (node == NULL) {
return NULL;
}
......@@ -313,7 +313,7 @@ void ClearTrigger(const TriggerWorkSpace *workSpace, int8_t type)
FreeTrigger(workSpace, trigger);
trigger = next;
}
ListInit(&head->triggerList);
OH_ListInit(&head->triggerList);
}
int ExecuteQueuePush(TriggerWorkSpace *workSpace, const TriggerNode *trigger)
......@@ -565,7 +565,7 @@ static int32_t CompareData_(const struct tagTriggerNode_ *trigger, const void *d
static void TriggerHeadSetDefault(TriggerHeader *head)
{
ListInit(&head->triggerList);
OH_ListInit(&head->triggerList);
head->triggerCount = 0;
head->cmdNodeCount = 0;
head->addTrigger = AddJobTrigger_;
......@@ -633,7 +633,7 @@ void InitTriggerHead(const TriggerWorkSpace *workSpace)
64
};
PARAM_CHECK(workSpace != NULL, return, "Invalid workSpace");
int ret = HashMapCreate((HashMapHandle *)&workSpace->hashMap, &info);
int ret = OH_HashMapCreate((HashMapHandle *)&workSpace->hashMap, &info);
PARAM_CHECK(ret == 0, return, "Failed to create hash map");
TriggerHeader *head = (TriggerHeader *)&workSpace->triggerHead[TRIGGER_BOOT];
......
......@@ -173,7 +173,7 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP
std::lock_guard<std::mutex> lock(watcherMutex_);
groupMap_[keyPrefix] = groupId;
watchers_[watcher->GetWatcherId()] = watcher;
ListAddTail(group->GetWatchers(), watcher->GetGroupNode());
OH_ListAddTail(group->GetWatchers(), watcher->GetGroupNode());
if (watcherGroups_.find(groupId) != watcherGroups_.end()) {
return;
......@@ -184,8 +184,8 @@ void WatcherManager::AddParamWatcher(const std::string &keyPrefix, WatcherGroupP
void WatcherManager::DelParamWatcher(ParamWatcherPtr watcher)
{
std::lock_guard<std::mutex> lock(watcherMutex_);
ListRemove(watcher->GetGroupNode());
ListInit(watcher->GetGroupNode());
OH_ListRemove(watcher->GetGroupNode());
OH_ListInit(watcher->GetGroupNode());
watchers_.erase(watcher->GetWatcherId());
WATCHER_LOGV("DelParamWatcher watcherId %u", watcher->GetWatcherId());
}
......
......@@ -67,7 +67,7 @@ public:
ParamWatcher(uint32_t watcherId, const sptr<IWatcher> &watcher, const WatcherGroupPtr &group)
: watcherId_(watcherId), watcher_(watcher), group_(group)
{
ListInit(&groupNode_);
OH_ListInit(&groupNode_);
}
~ParamWatcher() = default;
......@@ -104,7 +104,7 @@ public:
public:
WatcherGroup(uint32_t groupId, const std::string &key) : groupId_(groupId), keyPrefix_(key)
{
ListInit(&watchers_);
OH_ListInit(&watchers_);
}
~WatcherGroup() = default;
void AddWatcher(const ParamWatcherPtr &watcher);
......
......@@ -27,7 +27,7 @@ typedef struct {
} HashTab;
static uint32_t g_tableId = 0;
int32_t HashMapCreate(HashMapHandle *handle, const HashInfo *info)
int32_t OH_HashMapCreate(HashMapHandle *handle, const HashInfo *info)
{
INIT_ERROR_CHECK(handle != NULL && info != NULL && info->maxBucket > 0, return -1, "Invalid param");
INIT_ERROR_CHECK(info->keyHash != NULL && info->nodeHash != NULL, return -1, "Invalid param");
......@@ -71,7 +71,7 @@ static HashNode *GetHashNodeByKey(const HashTab *tab, const HashNode *root, cons
return NULL;
}
int32_t HashMapAdd(HashMapHandle handle, HashNode *node)
int32_t OH_HashMapAdd(HashMapHandle handle, HashNode *node)
{
INIT_ERROR_CHECK(handle != NULL, return -1, "Invalid param");
INIT_ERROR_CHECK(node != NULL && node->next == NULL, return -1, "Invalid param");
......@@ -89,11 +89,11 @@ int32_t HashMapAdd(HashMapHandle handle, HashNode *node)
}
node->next = tab->buckets[hashCode];
tab->buckets[hashCode] = node;
INIT_LOGV("HashMapAdd tableId %d hashCode %d node %p", tab->tableId, hashCode, node);
INIT_LOGV("OH_HashMapAdd tableId %d hashCode %d node %p", tab->tableId, hashCode, node);
return 0;
}
void HashMapRemove(HashMapHandle handle, const void *key)
void OH_HashMapRemove(HashMapHandle handle, const void *key)
{
INIT_ERROR_CHECK(handle != NULL && key != NULL, return, "Invalid param");
HashTab *tab = (HashTab *)handle;
......@@ -119,7 +119,7 @@ void HashMapRemove(HashMapHandle handle, const void *key)
}
}
HashNode *HashMapGet(HashMapHandle handle, const void *key)
HashNode *OH_HashMapGet(HashMapHandle handle, const void *key)
{
INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param %s", key);
HashTab *tab = (HashTab *)handle;
......@@ -146,7 +146,7 @@ static void HashListFree(HashTab *tab, HashNode *root)
}
}
void HashMapDestory(HashMapHandle handle)
void OH_HashMapDestory(HashMapHandle handle)
{
INIT_ERROR_CHECK(handle != NULL, return, "Invalid param");
HashTab *tab = (HashTab *)handle;
......@@ -156,7 +156,7 @@ void HashMapDestory(HashMapHandle handle)
free(tab);
}
HashNode *HashMapFind(HashMapHandle handle,
HashNode *OH_HashMapFind(HashMapHandle handle,
int hashCode, const void *key, HashKeyCompare keyCompare)
{
INIT_ERROR_CHECK(handle != NULL && key != NULL, return NULL, "Invalid param");
......@@ -167,7 +167,7 @@ HashNode *HashMapFind(HashMapHandle handle,
return GetHashNodeByKey(tab, tab->buckets[hashCode], key, keyCompare);
}
void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context),
void OH_HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNode *node, const void *context),
const void *context)
{
INIT_ERROR_CHECK(handle != NULL && hashNodeTraverse != NULL, return, "Invalid param");
......@@ -182,7 +182,7 @@ void HashMapTraverse(HashMapHandle handle, void (*hashNodeTraverse)(const HashNo
}
}
int HashMapIsEmpty(HashMapHandle handle)
int OH_HashMapIsEmpty(HashMapHandle handle)
{
INIT_ERROR_CHECK(handle != NULL, return 1, "Invalid param");
HashTab *tab = (HashTab *)handle;
......
......@@ -27,7 +27,7 @@
* @param head list head, make sure head is valid pointer
* @return None
*/
void ListInit(struct ListNode *node)
void OH_ListInit(struct ListNode *node)
{
if (node == NULL) {
return;
......@@ -43,7 +43,7 @@ void ListInit(struct ListNode *node)
* @param item new node to be added
* @return None
*/
void ListAddTail(struct ListNode *head, struct ListNode *item)
void OH_ListAddTail(struct ListNode *head, struct ListNode *item)
{
if (head == NULL || item == NULL) {
return;
......@@ -61,7 +61,7 @@ void ListAddTail(struct ListNode *head, struct ListNode *item)
* This function does not free any memory within item.
* @return None
*/
void ListRemove(struct ListNode *item)
void OH_ListRemove(struct ListNode *item)
{
if (item == NULL) {
return;
......@@ -81,7 +81,7 @@ void ListRemove(struct ListNode *item)
* respectively less than, equal to, or greater than the second.
* @return None
*/
void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc)
void OH_ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareProc compareProc)
{
ListNode *match;
int ret;
......@@ -117,7 +117,7 @@ void ListAddWithOrder(struct ListNode *head, struct ListNode *item, ListCompareP
* @param compareProc comparing function, return 0 if matched.
* @return the found node; return NULL if none is found.
*/
ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc compareProc)
ListNode *OH_ListFind(const ListNode *head, void *data, ListTraversalProc compareProc)
{
ListNode *match;
if ((head == NULL) || (compareProc == NULL)) {
......@@ -152,7 +152,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
* @return return -1 for invalid input arguments.
* when TRAVERSE_STOP_WHEN_ERROR is specified, it will return errors from traversalProc
*/
int ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags)
int OH_ListTraversal(ListNode *head, void *data, ListTraversalProc traversalProc, int flags)
{
int ret;
ListNode *match;
......@@ -203,14 +203,14 @@ static int listDestroyTraversal(ListNode *node, void *data)
* @param destroyProc destroy function; if NULL, it will free each node by default.
* @return None
*/
void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc)
void OH_ListRemoveAll(ListNode *head, ListDestroyProc destroyProc)
{
if (head == NULL) {
return;
}
ListTraversal(head, (void *)destroyProc, listDestroyTraversal, 0);
ListInit(head);
OH_ListTraversal(head, (void *)destroyProc, listDestroyTraversal, 0);
OH_ListInit(head);
}
/**
......@@ -219,7 +219,7 @@ void ListRemoveAll(ListNode *head, ListDestroyProc destroyProc)
* @param head list head, make sure head is valid pointer.
* @return the count of nodes in the list; return 0 if error
*/
int ListGetCnt(const ListNode *head)
int OH_ListGetCnt(const ListNode *head)
{
int cnt;
ListNode *node;
......
......@@ -108,54 +108,54 @@ HashInfo g_info = {
HWTEST_F(InitGroupManagerUnitTest, TestHashMap, TestSize.Level1)
{
HashMapHandle handle;
HashMapCreate(&handle, &g_info);
OH_HashMapCreate(&handle, &g_info);
const char *str1 = "Test hash map node 1";
const char *str2 = "Test hash map node 2";
const char *str3 = "Test hash map node 3";
TestHashNode *node1 = TestCreateHashNode(str1);
TestHashNode *node2 = TestCreateHashNode(str2);
HashMapAdd(handle, &node1->node);
HashMapAdd(handle, &node2->node);
HashNode *node = HashMapGet(handle, (const void *)str1);
OH_HashMapAdd(handle, &node1->node);
OH_HashMapAdd(handle, &node2->node);
HashNode *node = OH_HashMapGet(handle, (const void *)str1);
EXPECT_NE(node != nullptr, 0);
if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, str1), 0);
}
node = HashMapGet(handle, (const void *)str2);
node = OH_HashMapGet(handle, (const void *)str2);
EXPECT_NE(node != nullptr, 0);
if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, str2), 0);
}
TestHashNode *node3 = TestCreateHashNode(str3);
HashMapAdd(handle, &node3->node);
OH_HashMapAdd(handle, &node3->node);
node3 = TestCreateHashNode("Test hash map node 4");
HashMapAdd(handle, &node3->node);
OH_HashMapAdd(handle, &node3->node);
node3 = TestCreateHashNode("Test hash map node 5");
HashMapAdd(handle, &node3->node);
node = HashMapGet(handle, (const void *)str3);
OH_HashMapAdd(handle, &node3->node);
node = OH_HashMapGet(handle, (const void *)str3);
EXPECT_NE(node != nullptr, 0);
if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, str3), 0);
}
TestHashNode *node4 = TestCreateHashNode("pre-init");
HashMapAdd(handle, &node4->node);
OH_HashMapAdd(handle, &node4->node);
const char *act = "load_persist_props_action";
TestHashNode *node5 = TestCreateHashNode(act);
HashMapAdd(handle, &node5->node);
HashMapRemove(handle, "pre-init");
node = HashMapGet(handle, (const void *)act);
OH_HashMapAdd(handle, &node5->node);
OH_HashMapRemove(handle, "pre-init");
node = OH_HashMapGet(handle, (const void *)act);
EXPECT_NE(node != nullptr, 0);
if (node) {
TestHashNode *tmp = HASHMAP_ENTRY(node, TestHashNode, node);
EXPECT_EQ(strcmp(tmp->name, act), 0);
}
HashMapIsEmpty(handle);
HashMapTraverse(handle, [](const HashNode *node, const void *context) {return;}, nullptr);
HashMapDestory(handle);
OH_HashMapIsEmpty(handle);
OH_HashMapTraverse(handle, [](const HashNode *node, const void *context) {return;}, nullptr);
OH_HashMapDestory(handle);
}
HWTEST_F(InitGroupManagerUnitTest, TestInitGroupMgrInit, TestSize.Level1)
......
......@@ -194,7 +194,7 @@ public:
EXPECT_EQ(GetNextBuffer((StreamTask *)client, next), nullptr);
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != nullptr, return, "Failed to get watcher");
ListInit(&watcher->triggerHead);
OH_ListInit(&watcher->triggerHead);
OnClose(client);
LE_FreeBuffer(LE_GetDefaultLoop(), (TaskHandle)client, nullptr);
return;
......
......@@ -48,7 +48,7 @@ public:
};
HWTEST_F(ServiceUnitTest, TestDestoryHashMap, TestSize.Level1)
{
HashMapDestory(GetInitWorkspace()->hashMap[0]);
OH_HashMapDestory(GetInitWorkspace()->hashMap[0]);
}
HWTEST_F(ServiceUnitTest, case01, TestSize.Level1)
{
......
......@@ -313,7 +313,7 @@ public:
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != NULL, return NULL, "Failed to get watcher");
ListInit(&watcher->triggerHead);
OH_ListInit(&watcher->triggerHead);
watcher->stream = client;
GetParamService()->watcherTask = client;
return GetParamService()->watcherTask;
......
......@@ -470,7 +470,7 @@ public:
{
RegisterBootStateChange(BootStateChange);
(void)AddCompleteJob("param:ohos.servicectrl.display", "ohos.servicectrl.display=*", "display system");
HashMapDestory(GetTriggerWorkSpace()->hashMap);
OH_HashMapDestory(GetTriggerWorkSpace()->hashMap);
return 0;
}
};
......
......@@ -54,8 +54,8 @@ static struct DeviceUdevConf *GetFristParameter(DeviceParameterCtrl *parameterCt
pthread_mutex_lock(&(parameterCtrl->parameterLock));
if (!ListEmpty(parameterCtrl->parameterList)) {
conf = ListEntry(parameterCtrl->parameterList.next, struct DeviceUdevConf, paramNode);
ListRemove(&conf->paramNode);
ListInit(&conf->paramNode);
OH_ListRemove(&conf->paramNode);
OH_ListInit(&conf->paramNode);
}
pthread_mutex_unlock(&(parameterCtrl->parameterLock));
return conf;
......@@ -93,7 +93,7 @@ static void *ThreadRun(void *data)
if (SystemSetParameter(config->parameter, paramValue) != 0) {
INIT_LOGE("[uevent] SystemSetParameter %s failed", config->parameter);
pthread_mutex_lock(&(parameterCtrl->parameterLock));
ListAddTail(&parameterCtrl->parameterList, &config->paramNode);
OH_ListAddTail(&parameterCtrl->parameterList, &config->paramNode);
pthread_mutex_unlock(&(parameterCtrl->parameterLock));
parameterCtrl->empty = 1;
}
......@@ -105,7 +105,7 @@ static void AddParameter(DeviceParameterCtrl *parameterCtrl, struct DeviceUdevCo
{
pthread_mutex_lock(&(parameterCtrl->parameterLock));
if (ListEmpty(config->paramNode)) {
ListAddTail(&parameterCtrl->parameterList, &config->paramNode);
OH_ListAddTail(&parameterCtrl->parameterList, &config->paramNode);
}
pthread_mutex_unlock(&(parameterCtrl->parameterLock));
if (parameterCtrl->threadId == 0) {
......
......@@ -108,8 +108,8 @@ static int ParseDeviceConfig(char *p)
} else {
config->parameter = NULL;
}
ListInit(&config->paramNode);
ListAddTail(&g_devices, &config->list);
OH_ListInit(&config->paramNode);
OH_ListAddTail(&g_devices, &config->list);
FreeStringVector(items, count);
return 0;
}
......@@ -143,7 +143,7 @@ static int ParseSysfsConfig(char *p)
"Invalid mode in config file for sys path %s. use default mode", config->sysPath);
config->uid = (uid_t)DecodeUid(items[SYS_CONFIG_UID_NUM]);
config->gid = (gid_t)DecodeGid(items[SYS_CONFIG_GID_NUM]);
ListAddTail(&g_sysDevices, &config->list);
OH_ListAddTail(&g_sysDevices, &config->list);
FreeStringVector(items, count);
return 0;
}
......@@ -161,7 +161,7 @@ static int ParseFirmwareConfig(char *p)
INIT_CHECK(config != NULL, errno = ENOMEM;
return -1);
config->fmPath = strdup(p);
ListAddTail(&g_firmwares, &config->list);
OH_ListAddTail(&g_firmwares, &config->list);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册