Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12671

Fix function prototypes that doesn't take arguments

XMLWordPrintable

    • Sprint 23, Sprint 27
    • 1

      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.

            MVekslers Michael Veksler
            abs Andrea Biscuola (Inactive)
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: