simplify args_getNode_hash

This commit is contained in:
Gabriel Wang 2022-01-24 15:42:37 +00:00 committed by Lyon
parent b6f698d2c0
commit c1867930c7

View File

@ -245,21 +245,20 @@ int32_t args_setArg(Args* self, Arg* arg) {
}
LinkNode* args_getNode_hash(Args* self, Hash nameHash) {
LinkNode* nodeNow = self->firstNode;
if (NULL == nodeNow) {
return NULL;
}
while (1) {
while (NULL != nodeNow) {
Arg* arg = nodeNow;
Hash thisNameHash = arg_getNameHash(arg);
if (thisNameHash == nameHash) {
return nodeNow;
}
if (NULL == content_getNext(nodeNow)) {
return NULL;
}
nodeNow = content_getNext(nodeNow);
}
return NULL;
}
LinkNode* args_getNode(Args* self, char* name) {