Skip to content

Commit 8dd2746

Browse files
committed
rename get_key_ptr to get_or_create_ptr_from_arg
1 parent 7f6c318 commit 8dd2746

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

pythonbpf/helper/helper_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def create_int_constant_ptr(value, builder, int_width=64):
3737
return ptr
3838

3939

40-
def get_key_ptr(key_arg, builder, local_sym_tab):
40+
def get_or_create_ptr_from_arg(arg, builder, local_sym_tab):
4141
"""Extract key pointer from the call arguments."""
4242

43-
if isinstance(key_arg, ast.Name):
44-
key_ptr = get_var_ptr_from_name(key_arg.id, local_sym_tab)
45-
elif isinstance(key_arg, ast.Constant) and isinstance(key_arg.value, int):
46-
key_ptr = create_int_constant_ptr(key_arg.value, builder)
43+
if isinstance(arg, ast.Name):
44+
ptr = get_var_ptr_from_name(arg.id, local_sym_tab)
45+
elif isinstance(arg, ast.Constant) and isinstance(arg.value, int):
46+
ptr = create_int_constant_ptr(arg.value, builder)
4747
else:
4848
raise NotImplementedError(
4949
"Only simple variable names are supported as keys in map lookup.")
50-
return key_ptr
50+
return ptr

0 commit comments

Comments
 (0)