]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move the stringify macros to build.h
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 24 Aug 2013 17:02:42 +0000 (18:02 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 24 Aug 2013 17:03:12 +0000 (18:03 +0100)
src/include/build.h
src/include/conffile.h
src/main/detail.c
src/main/mainconfig.c
src/main/realms.c
src/main/xlat.c
src/modules/rlm_perl/rlm_perl.c

index 694b53fc331c4f74784bf7693890a7ce4f0c65c9..403965d4cbec8a24e2deeb3e78ce8efa2497c5c7 100644 (file)
@@ -9,11 +9,16 @@
 extern "C" {
 #endif
 
+/*
+ *     The ubiquitous stringify macros
+ */
+#define XSTRINGIFY(x) #x
+#define STRINGIFY(x) XSTRINGIFY(x)
+
 /*
  *     Macros for controlling warnings in GCC >= 4.2 and clang >= 2.8
  */
-#define DIAG_STR(s) #s
-#define DIAG_JOINSTR(x,y) DIAG_STR(x ## y)
+#define DIAG_JOINSTR(x,y) XSTRINGIFY(x ## y)
 #define DIAG_DO_PRAGMA(x) _Pragma (#x)
 
 #if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
index ca39293c12383c64e305b7c4b12053bd66a3bce7..f16ba26afe04cc0ebf122722efdc492e2be5aaf3 100644 (file)
@@ -47,10 +47,6 @@ typedef struct CONF_PARSER {
   const void *dflt;            /* default as it would appear in radiusd.conf */
 } CONF_PARSER;
 
-/* This preprocessor trick will be useful in initializing CONF_PARSER struct */
-#define XStringify(x) #x
-#define Stringify(x) XStringify(x)
-
 CONF_SECTION   *cf_section_alloc(CONF_SECTION *parent, char const *name1,
                                  char const *name2);
 int            cf_pair_replace(CONF_SECTION *cs, CONF_PAIR *cp,
index 59889528b22c913b9485f337006811e132d58b4f..9068e4ac71e5f8ae2621e7d8cb7ff308311fd90a 100644 (file)
@@ -835,11 +835,11 @@ static const CONF_PARSER detail_config[] = {
        { "filename",   PW_TYPE_FILE_OUTPUT | PW_TYPE_REQUIRED,
          offsetof(listen_detail_t, filename), NULL,  NULL },
        { "load_factor",   PW_TYPE_INTEGER,
-         offsetof(listen_detail_t, load_factor), NULL, Stringify(10)},
+         offsetof(listen_detail_t, load_factor), NULL, STRINGIFY(10)},
        { "poll_interval",   PW_TYPE_INTEGER,
-         offsetof(listen_detail_t, poll_interval), NULL, Stringify(1)},
+         offsetof(listen_detail_t, poll_interval), NULL, STRINGIFY(1)},
        { "retry_interval",   PW_TYPE_INTEGER,
-         offsetof(listen_detail_t, retry_interval), NULL, Stringify(30)},
+         offsetof(listen_detail_t, retry_interval), NULL, STRINGIFY(30)},
        { "one_shot",   PW_TYPE_BOOLEAN,
          offsetof(listen_detail_t, one_shot), NULL, NULL},
        { "max_outstanding",   PW_TYPE_INTEGER,
index 42d1981357689c755f4601da064fbe98ca97a23d..64115ea03e3b10742b489f40cee187b112226d85 100644 (file)
@@ -102,8 +102,8 @@ static int do_colourise = false;
  *  Security configuration for the server.
  */
 static const CONF_PARSER security_config[] = {
-       { "max_attributes",  PW_TYPE_INTEGER, 0, &fr_max_attributes, Stringify(0) },
-       { "reject_delay",  PW_TYPE_INTEGER, 0, &mainconfig.reject_delay, Stringify(0) },
+       { "max_attributes",  PW_TYPE_INTEGER, 0, &fr_max_attributes, STRINGIFY(0) },
+       { "reject_delay",  PW_TYPE_INTEGER, 0, &mainconfig.reject_delay, STRINGIFY(0) },
        { "status_server", PW_TYPE_BOOLEAN, 0, &mainconfig.status_server, "no"},
        { NULL, -1, 0, NULL, NULL }
 };
@@ -114,7 +114,7 @@ static const CONF_PARSER security_config[] = {
  */
 static const CONF_PARSER logdest_config[] = {
        { "destination",  PW_TYPE_STRING_PTR, 0, &radlog_dest, "files" },
-       { "syslog_facility",  PW_TYPE_STRING_PTR, 0, &syslog_facility, Stringify(0) },
+       { "syslog_facility",  PW_TYPE_STRING_PTR, 0, &syslog_facility, STRINGIFY(0) },
 
        { "file", PW_TYPE_STRING_PTR, 0, &mainconfig.log_file, "${logdir}/radius.log" },
        { "requests", PW_TYPE_STRING_PTR, 0, &default_log.file, NULL },
@@ -165,11 +165,11 @@ static const CONF_PARSER server_config[] = {
        { "libdir",          PW_TYPE_STRING_PTR, 0, &radlib_dir,        "${prefix}/lib"},
        { "radacctdir",  PW_TYPE_STRING_PTR, 0, &radacct_dir,       "${logdir}/radacct" },
        { "hostname_lookups",   PW_TYPE_BOOLEAN,    0, &fr_dns_lookups,      "no" },
-       { "max_request_time", PW_TYPE_INTEGER, 0, &mainconfig.max_request_time, Stringify(MAX_REQUEST_TIME) },
-       { "cleanup_delay", PW_TYPE_INTEGER, 0, &mainconfig.cleanup_delay, Stringify(CLEANUP_DELAY) },
-       { "max_requests", PW_TYPE_INTEGER, 0, &mainconfig.max_requests, Stringify(MAX_REQUESTS) },
+       { "max_request_time", PW_TYPE_INTEGER, 0, &mainconfig.max_request_time, STRINGIFY(MAX_REQUEST_TIME) },
+       { "cleanup_delay", PW_TYPE_INTEGER, 0, &mainconfig.cleanup_delay, STRINGIFY(CLEANUP_DELAY) },
+       { "max_requests", PW_TYPE_INTEGER, 0, &mainconfig.max_requests, STRINGIFY(MAX_REQUESTS) },
 #ifdef DELETE_BLOCKED_REQUESTS
-       { "delete_blocked_requests", PW_TYPE_INTEGER, 0, &mainconfig.kill_unresponsive_children, Stringify(false) },
+       { "delete_blocked_requests", PW_TYPE_INTEGER, 0, &mainconfig.kill_unresponsive_children, STRINGIFY(false) },
 #endif
        { "pidfile", PW_TYPE_STRING_PTR, 0, &mainconfig.pid_file, "${run_dir}/radiusd.pid"},
        { "checkrad", PW_TYPE_STRING_PTR, 0, &mainconfig.checkrad, "${sbindir}/checkrad" },
index 1bd67c8e41469fb9afd073ad32c214202e22230f..d0913ab1c543f54904ec9f72d47b16f702f90765 100644 (file)
@@ -70,11 +70,11 @@ static rbtree_t     *home_pools_byname = NULL;
 static const CONF_PARSER proxy_config[] = {
        { "retry_delay",  PW_TYPE_INTEGER,
          offsetof(realm_config_t, retry_delay),
-         NULL, Stringify(RETRY_DELAY) },
+         NULL, STRINGIFY(RETRY_DELAY) },
 
        { "retry_count",  PW_TYPE_INTEGER,
          offsetof(realm_config_t, retry_count),
-         NULL, Stringify(RETRY_COUNT) },
+         NULL, STRINGIFY(RETRY_COUNT) },
 
        { "default_fallback", PW_TYPE_BOOLEAN,
          offsetof(realm_config_t, fallback),
@@ -82,7 +82,7 @@ static const CONF_PARSER proxy_config[] = {
 
        { "dead_time",    PW_TYPE_INTEGER,
          offsetof(realm_config_t, dead_time),
-         NULL, Stringify(DEAD_TIME) },
+         NULL, STRINGIFY(DEAD_TIME) },
 
        { "wake_all_if_all_dead", PW_TYPE_BOOLEAN,
          offsetof(realm_config_t, wake_all_if_all_dead),
@@ -307,13 +307,13 @@ static char *hs_proto = NULL;
 #ifdef WITH_COA
 static CONF_PARSER home_server_coa[] = {
        { "irt",  PW_TYPE_INTEGER,
-         offsetof(home_server, coa_irt), 0, Stringify(2) },
+         offsetof(home_server, coa_irt), 0, STRINGIFY(2) },
        { "mrt",  PW_TYPE_INTEGER,
-         offsetof(home_server, coa_mrt), 0, Stringify(16) },
+         offsetof(home_server, coa_mrt), 0, STRINGIFY(16) },
        { "mrc",  PW_TYPE_INTEGER,
-         offsetof(home_server, coa_mrc), 0, Stringify(5) },
+         offsetof(home_server, coa_mrc), 0, STRINGIFY(5) },
        { "mrd",  PW_TYPE_INTEGER,
-         offsetof(home_server, coa_mrd), 0, Stringify(30) },
+         offsetof(home_server, coa_mrd), 0, STRINGIFY(30) },
 
        { NULL, -1, 0, NULL, NULL }             /* end the list */
 };
index 9434185f36b9c3bca751347d10c8fd3619a6185d..0d5745dd98ddde86a3c5a1597dcb59b13c9f4797 100644 (file)
@@ -449,8 +449,8 @@ int xlat_register(char const *name, RAD_XLAT_FUNC func, RADIUS_ESCAPE_STRING esc
                }
 #endif
 
-#define XLAT_REGISTER(_x) xlat_register(Stringify(_x), xlat_ ## _x, NULL, NULL); \
-               c = xlat_find(Stringify(_x)); \
+#define XLAT_REGISTER(_x) xlat_register(STRINGIFY(_x), xlat_ ## _x, NULL, NULL); \
+               c = xlat_find(STRINGIFY(_x)); \
                rad_assert(c != NULL); \
                c->internal = true
 
index e4bed0f2d40542f372c41c354c081c34f6bbc359..7b46f7b54f350bdd3a06b2b1abc27ed7ab578e3f 100644 (file)
@@ -80,8 +80,8 @@ typedef struct rlm_perl_t {
 /*
  *     A mapping of configuration file names to internal variables.
  */
-#define RLM_PERL_CONF(_x) { "func_" Stringify(_x), PW_TYPE_STRING_PTR, \
-                       offsetof(rlm_perl_t,func_##_x), NULL, Stringify(_x)}
+#define RLM_PERL_CONF(_x) { "func_" STRINGIFY(_x), PW_TYPE_STRING_PTR, \
+                       offsetof(rlm_perl_t,func_##_x), NULL, STRINGIFY(_x)}
 
 static const CONF_PARSER module_config[] = {
        { "module",  PW_TYPE_FILE_INPUT | PW_TYPE_DEPRECATED,