tree-wide: port over all code to the new CONFIG_PARSER_PROTOTYPE() macro

This makes most header files easier to look at. Also Emacs gets really
slow when browsing through large sections of overly long prototypes,
which is much improved by this macro.

We should probably not do something similar with too many other cases,
as macros like this might help readability for some, but make it worse
for others. But I think given the complexity of this specific prototype
and how often we use it, it's worth doing.
This commit is contained in:
Lennart Poettering
2018-05-22 13:18:44 +02:00
parent 1f12b48a73
commit a210692525
23 changed files with 235 additions and 249 deletions
+3 -2
View File
@@ -7,6 +7,7 @@
Copyright 2016 Lennart Poettering
***/
#include "conf-parser.h"
#include "macro.h"
typedef enum ResolveSupport ResolveSupport;
@@ -38,8 +39,8 @@ enum DnssecMode {
_DNSSEC_MODE_INVALID = -1
};
int config_parse_resolve_support(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_dnssec_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
CONFIG_PARSER_PROTOTYPE(config_parse_resolve_support);
CONFIG_PARSER_PROTOTYPE(config_parse_dnssec_mode);
const char* resolve_support_to_string(ResolveSupport p) _const_;
ResolveSupport resolve_support_from_string(const char *s) _pure_;
+4 -2
View File
@@ -10,6 +10,8 @@
#include <stdbool.h>
#include <inttypes.h>
#include "conf-parser.h"
#define VLANID_MAX 4094
#define VLANID_INVALID UINT16_MAX
@@ -20,5 +22,5 @@ static inline bool vlanid_is_valid(uint16_t id) {
int parse_vlanid(const char *p, uint16_t *ret);
int config_parse_default_port_vlanid(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_vlanid(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
CONFIG_PARSER_PROTOTYPE(config_parse_default_port_vlanid);
CONFIG_PARSER_PROTOTYPE(config_parse_vlanid);