mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1837: Vim9: class_member_type() can be optimized
Problem: Vim9: class_member_type() can be optimized Solution: class_member_type() provides more information; safe an additional alloc()/free() closes: #12989 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
This commit is contained in:
committed by
Christian Brabandt
parent
c41b7a26fc
commit
456ae556b4
@@ -1554,6 +1554,7 @@ cleanup:
|
||||
* Find member "name" in class "cl", set "member_idx" to the member index and
|
||||
* return its type.
|
||||
* When not found "member_idx" is set to -1 and t_any is returned.
|
||||
* Set *p_m ocmmember_T if not NULL
|
||||
*/
|
||||
type_T *
|
||||
class_member_type(
|
||||
@@ -1561,7 +1562,7 @@ class_member_type(
|
||||
char_u *name,
|
||||
char_u *name_end,
|
||||
int *member_idx,
|
||||
omacc_T *access)
|
||||
ocmember_T **p_m)
|
||||
{
|
||||
*member_idx = -1; // not found (yet)
|
||||
size_t len = name_end - name;
|
||||
@@ -1572,7 +1573,8 @@ class_member_type(
|
||||
if (STRNCMP(m->ocm_name, name, len) == 0 && m->ocm_name[len] == NUL)
|
||||
{
|
||||
*member_idx = i;
|
||||
*access = m->ocm_access;
|
||||
if (p_m != NULL)
|
||||
*p_m = m;
|
||||
return m->ocm_type;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user