3 useless EventHandlerPtr in the ARP Analyzer

Description

The class analyzer::arp::ARP_Analyzer declared in the file src/analyzer/protocol/arp/ARP.h declares 3 protected EventHandlerPtr that are never initialized and never used.
What the corresponding source file refer to are the following global variables :

  • bad_arp

  • arp_request

  • arp_reply
    which are declared as "extern" in the file build/src/analyzer/protocol/arp/events.bif.h which is generated by bifcl from src/analyzer/protocol/arp/events.bif.

Fixing this issue is trivial : deleting the 3 lines declaring the unused EventHandlerPtr.
The expected improvement is saving 3 bytes of memory and mostly not messing with those who will try to understand the code of this analyzer in the future.

Environment

None

Activity

Show:
Johanna Amann
April 26, 2016, 3:28 PM

I might miss something - but it seems that those EventHanderPtrs are initialized in ARP_Analyzer::ARP_Analyzer in ARP.cc (lines 13-15).

They are also used to send events later in ARP.cc

llh
April 27, 2016, 9:03 AM

I did make a successful test without the 3 lines. As I said in the description, the event handler pointers used and initialized are those declared in events.bif.h. Should you doubt about it, you can see that the event handler pointer ARP_Analyzer::arp_corrupted_packet is never referred to in the entire project, whereas the definitions of the functions of ARP_Analyzer refer to the global variables, including "bad_arp", which might be what the author wanted to name "arp_corrupted_packet".

Should I be wrong about removing those lines, it is still a bad idea to have class members with the same name as global variables (here "arp_request" and "arp_reply").

Johanna Amann
April 27, 2016, 1:52 PM

You are right; this is fixed in 3a70289e91b09640cda77a0534aa997a15fff40f

Assignee

Unassigned

Reporter

llh

Labels

None

External issue ID

None

Components

Priority

Trivial
Configure