Skip to content

Commit

Permalink
improve object_array
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Nov 7, 2024
1 parent b5b0814 commit 8046e91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
2024/11/07
* 修复locale_infos_unref接口释放info对象无法清除assets_manager上的野指针导致崩溃的问题(感谢雨欣提供补丁)
* 完善object_hash(感谢兆坤提供补丁)
* 完善object_array(感谢兆坤提供补丁)
* 统一是否可从名字中获取index的判断逻辑(感谢兆坤提供补丁)

2024/11/06
Expand Down
4 changes: 2 additions & 2 deletions src/tkc/object_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static ret_t object_array_find_props(tk_object_t* obj, tk_compare_t cmp, const v
value_t* iter = &o->props[i];
tk_snprintf(name, TK_NAME_LEN, "%" PRIu32, i);
value_copy(&(nv.value), iter);
if (0 == cmp(data, &nv)) {
if (0 == cmp(&nv, data)) {
ret = darray_push(matched, iter);
}
}
Expand All @@ -422,7 +422,7 @@ static value_t* object_array_find_prop(tk_object_t* obj, tk_compare_t cmp, const
value_t* iter = &o->props[i];
tk_snprintf(name, TK_NAME_LEN, "%" PRIu32, i);
value_copy(&(nv.value), iter);
if (0 == cmp(ctx, &nv)) {
if (0 == cmp(&nv, ctx)) {
return iter;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/object_array_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ TEST(ObjectArray, push_and_remove) {
TK_OBJECT_UNREF(obj);
}

static int is_even(const void* ctx, const void* data) {
static int is_even(const void* data, const void* ctx) {
const named_value_t* nv = (const named_value_t*)(data);
uint32_t num = value_uint32(&nv->value);
return (num % 2 == 0) ? 0 : -1;
Expand Down

0 comments on commit 8046e91

Please sign in to comment.