Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bpf): cleanup initialising structs and nested ifs (#1444)
This commit changes all declarae and then initialise code of form below ``` struct foobar x; x.a = a; x.b = b; ``` to ``` struct foobar x = { .a = a, .b = b, }; ``` The difference in the code produced is as follows ``` ; new_pid_key.pid = cur_pid; | pid_time_t new_pid_key = {.pid = cur_pid }; 0: 63 6a fc ff 00 00 00 00 *(u32 *)(r10 - 0x4) = r6 | 0: 79 a1 68 ff 00 00 00 00 r1 = *(u64 *)(r10 - 0x98) 1: bf a2 00 00 00 00 00 00 r2 = r10 | 1: 63 1a fc ff 00 00 00 00 *(u32 *)(r10 - 0x4) = r1 2: 07 02 00 00 fc ff ff ff r2 += -0x4 | 2: bf a2 00 00 00 00 00 00 r2 = r10 3: bf a3 00 00 00 00 00 00 r3 = r10 | 3: 07 02 00 00 f0 ff ff ff r2 += -0x10 4: 07 03 00 00 70 ff ff ff r3 += -0x90 ``` Modifies calc_delta to remove unnecessary pointer deferencing of second arg - `val` Signed-off-by: Sunil Thaha <[email protected]> (cherry picked from commit ac43e26)
- Loading branch information