]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use C99 initialisers for cache drivers too
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 16 May 2015 22:32:59 +0000 (18:32 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 16 May 2015 22:33:06 +0000 (18:33 -0400)
src/modules/rlm_cache/drivers/rlm_cache_memcached/rlm_cache_memcached.c
src/modules/rlm_cache/drivers/rlm_cache_rbtree/rlm_cache_rbtree.c
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_cache/rlm_cache.h

index ffaa15b0f5872a37741c7731d5277e8781652667..65b42474d2f655b72b8321c0683dbf5ca62a284a 100644 (file)
@@ -334,16 +334,15 @@ static int mod_conn_reconnect(rlm_cache_t *inst, UNUSED REQUEST *request, rlm_ca
 
 extern cache_module_t rlm_cache_memcached;
 cache_module_t rlm_cache_memcached = {
-       "rlm_cache_memcached",
-       mod_instantiate,
-       NULL,                   /* alloc */
-       cache_entry_free,
-       cache_entry_find,
-       cache_entry_insert,
-       cache_entry_expire,
-       NULL,                   /* count */
-
-       mod_conn_get,
-       mod_conn_release,
-       mod_conn_reconnect
+       .name           = "rlm_cache_memcached",
+       .instantiate    = mod_instantiate,
+       .free           = cache_entry_free,
+
+       .find           = cache_entry_find,
+       .insert         = cache_entry_insert,
+       .expire         = cache_entry_expire,
+
+       .acquire        = mod_conn_get,
+       .release        = mod_conn_release,
+       .reconnect      = mod_conn_reconnect
 };
index c79f1b07ea35fd45c4428f51d24b973aa27ea977..2db7c93b809e049ac2d04a5d33650f3e5b2a938f 100644 (file)
@@ -337,16 +337,15 @@ static void cache_release(UNUSED rlm_cache_t *inst, REQUEST *request, rlm_cache_
 
 extern cache_module_t rlm_cache_rbtree;
 cache_module_t rlm_cache_rbtree = {
-       "rlm_cache_rbtree",
-       mod_instantiate,
-       cache_entry_alloc,
-       NULL,                   /* free */
-       cache_entry_find,
-       cache_entry_insert,
-       cache_entry_expire,
-       cache_entry_count,
-
-       cache_acquire,
-       cache_release,
-       NULL                    /* no reconnect method */
+       .name           = "rlm_cache_rbtree",
+       .instantiate    = mod_instantiate,
+       .alloc          = cache_entry_alloc,
+
+       .find           = cache_entry_find,
+       .insert         = cache_entry_insert,
+       .expire         = cache_entry_expire,
+       .count          = cache_entry_count,
+
+       .acquire        = cache_acquire,
+       .release        = cache_release,
 };
index 54ec5f3595f8f05caab00b0441f7f72250dbad90..42e2b92ed9bab0566f544d078d4cbcf1e4ca9bbe 100644 (file)
@@ -737,7 +737,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
        rad_assert(inst->module->insert);
        rad_assert(inst->module->expire);
 
-       if (inst->module->mod_instantiate) {
+       if (inst->module->instantiate) {
                CONF_SECTION *cs;
                char const *name;
 
@@ -760,7 +760,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
                 *      Should write its instance data in inst->driver,
                 *      and parent it off of inst.
                 */
-               if (inst->module->mod_instantiate(cs, inst) < 0) return -1;
+               if (inst->module->instantiate(cs, inst) < 0) return -1;
        }
 
        rad_assert(inst->key && *inst->key);
index a7e0abf2397e151dfaccf537e297bc240d3c44ee..10f6a4c824d2e00dee8d32b0c7a3ea222d9daef1 100644 (file)
@@ -77,7 +77,7 @@ typedef struct rlm_cache_entry_t {
        VALUE_PAIR              *state;                 //!< Cached session-state list.
 } rlm_cache_entry_t;
 
-typedef int                    (*mod_instantiate_t)(CONF_SECTION *conf, rlm_cache_t *inst);
+typedef int                    (*cache_instantiate_t)(CONF_SECTION *conf, rlm_cache_t *inst);
 typedef rlm_cache_entry_t      *(*cache_entry_alloc_t)(rlm_cache_t *inst, REQUEST *request);
 typedef void                   (*cache_entry_free_t)(rlm_cache_entry_t *c);
 
@@ -97,7 +97,7 @@ typedef int                   (*cache_reconnect_t)(rlm_cache_t *inst, REQUEST *request, rlm_cach
 struct cache_module {
        char const              *name;                  //!< Driver name.
 
-       mod_instantiate_t       mod_instantiate;        //!< (optional) Instantiate a driver.
+       cache_instantiate_t     instantiate;            //!< (optional) Instantiate a driver.
        cache_entry_alloc_t     alloc;                  //!< (optional) Allocate a new entry.
        cache_entry_free_t      free;                   //!< (optional) Free memory used by an entry.