Hi, Generally speaking, I think that assertions in cases when local (static) function is invoked with wrong parameters are legal. The caller function must take care about parameters (and it does currently in packet-pw-atm.c). For global functions some other approach should be used, of course.
Specifically, I consider replacing assert(payload_size >= 0) with DISSECTOR_ASSERT as acceptable. But I do not like removal of NULL pointer check. I believe that aboring application internally (via abort()) is always better than aborting via exception in the OS kernel. Removing second assert() also removes important information: "this function REQUIRES to be invoked with valid pointer as a parameter". Regards, Artem Tamazov TELLABS -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Wednesday, July 01, 2009 2:56 AM To: [email protected] Subject: [Wireshark-commits] rev 28900: /trunk/epan/dissectors/ /trunk/epan/dissectors/: packet-pw-atm.c http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=28900 User: guy Date: 2009/06/30 04:56 PM Log: Replace one assert() with DISSECTOR_ASSET(), so we don't crash, and get rid of another, as the pointer in question is non-null in all calls (if somebody adds another call with a null pointer, it'll crash when dereferencing the pointer in any case). Directory: /trunk/epan/dissectors/ Changes Path Action +2 -2 packet-pw-atm.c Modified ___________________________________________________________________________ Sent via: Wireshark-commits mailing list <[email protected]> Archives: http://www.wireshark.org/lists/wireshark-commits Unsubscribe: https://wireshark.org/mailman/options/wireshark-commits mailto:[email protected]?subject=unsubscribe ============================================================ The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reproduction, dissemination or distribution of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Tellabs ============================================================ ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <[email protected]> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:[email protected]?subject=unsubscribe
