[ZBX-12671] Fix function prototypes that doesn't take arguments Created: 2017 Sep 04  Updated: 2024 Apr 10  Resolved: 2018 Feb 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Server (S)
Affects Version/s: None
Fix Version/s: 4.0.0alpha2, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Andrea Biscuola (Inactive) Assignee: Michael Veksler
Resolution: Fixed Votes: 0
Labels: agent, correctness, refactoring, server
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: DEV-591
Team: Team C
Sprint: Sprint 23, Sprint 27
Story Points: 1

 Description   

In the zabbix C codebase, there are a lot of examples of function prototypes and declarations that doesn't take arguments and are declared like this:

void    zbx_preprocessor_flush();

This actually doesn't mean "this function does not take arguments", but it mean "this function can take any number of arguments". The proper declaration should be:

void    zbx_preprocessor_flush(void);

both in the prototype and the function declaration.

In at least an occasion, I found an instance of a function declared in the former way that was called with arguments when it was unuseful. For having an idea, just enable the -Wstrict-prototypes flag in your compiler (both gcc and clang accept it).

This also is the case with the callback declarations of the loadable modules. We should also check and use a proper signature for the called functions.



 Comments   
Comment by Michael Veksler [ 2017 Dec 21 ]

Available in pre-4.0.0alpha2 (trunk) r76259

Generated at Wed Apr 24 18:43:36 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.