Skip to content

Commit 8ad5fb8

Browse files
committed
Janitorial: Remove useless comments
1 parent bf9635e commit 8ad5fb8

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

pythonbpf/expr/ir_ops.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,18 @@ def _null_checked_operation(func, builder, ptr, operation, result_type, name_pre
3737
not_null_block = func.append_basic_block(name=f"{name_prefix}_not_null")
3838
merge_block = func.append_basic_block(name=f"{name_prefix}_merge")
3939

40-
# Null check
4140
null_ptr = ir.Constant(ptr.type, None)
4241
is_not_null = builder.icmp_signed("!=", ptr, null_ptr)
4342
builder.cbranch(is_not_null, not_null_block, merge_block)
4443

45-
# Not-null path: execute operation
4644
builder.position_at_end(not_null_block)
4745
result = operation(builder, ptr)
4846
not_null_after = builder.block
4947
builder.branch(merge_block)
5048

51-
# Merge with PHI
5249
builder.position_at_end(merge_block)
5350
phi = builder.phi(result_type, name=f"{name_prefix}_result")
5451

55-
# Null fallback value
5652
if isinstance(result_type, ir.IntType):
5753
null_val = ir.Constant(result_type, 0)
5854
elif isinstance(result_type, ir.PointerType):
@@ -72,7 +68,6 @@ def access_struct_field(
7268
"""
7369
Access a struct field - automatically returns value or pointer based on field type.
7470
"""
75-
# Get struct metadata
7671
metadata = (
7772
structs_sym_tab.get(var_metadata)
7873
if isinstance(var_metadata, str)
@@ -89,10 +84,8 @@ def access_struct_field(
8984
# Get struct pointer
9085
struct_ptr = builder.load(var_ptr) if is_ptr_to_struct else var_ptr
9186

92-
# Decide: load value or return pointer?
9387
should_load = not isinstance(field_type, ir.ArrayType)
9488

95-
# Define the field access operation
9689
def field_access_op(builder, ptr):
9790
typed_ptr = builder.bitcast(ptr, metadata.ir_type.as_pointer())
9891
field_ptr = metadata.gep(builder, typed_ptr, field_name)
@@ -118,7 +111,6 @@ def field_access_op(builder, ptr):
118111
)
119112
return result, field_type
120113

121-
# No null check needed
122114
field_ptr = metadata.gep(builder, struct_ptr, field_name)
123115
result = builder.load(field_ptr) if should_load else field_ptr
124116
return result, field_type

pythonbpf/helper/helper_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ def get_char_array_ptr_and_size(
304304
logger.warning("Field is not a char array")
305305
return None, 0
306306

307-
# Get field pointer (automatically handles null checks!)
308307
field_ptr, _ = access_struct_field(
309308
builder,
310309
struct_ptr,

0 commit comments

Comments
 (0)