Massively cleaned up #include's, so they're in a consistent
[freeradius.git] / src / modules / rlm_expr / rlm_expr.c
index c6308a6..8c76d94 100644 (file)
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  *
- * Copyright 2002  The FreeRADIUS server project
+ * Copyright 2002,2006  The FreeRADIUS server project
  * Copyright 2002  Alan DeKok <aland@ox.org>
  */
 
-#include "autoconf.h"
-#include "libradius.h"
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "radiusd.h"
-#include "modules.h"
-#include "conffile.h"
-
-static const char rcsid[] = "$Id$";
+#include <freeradius-devel/radiusd.h>
+#include <freeradius-devel/modules.h>
 
 /*
  *     Define a structure for our module configuration.
@@ -74,7 +67,8 @@ static expr_map_t map[] =
 static int get_number(REQUEST *request, const char **string, int *answer)
 {
        int             i, found;
-       uint32_t        result, x;
+       uint32_t        result;
+       int             x;
        const char      *p;
        expr_token_t    this;
 
@@ -280,6 +274,10 @@ static int expr_instantiate(CONF_SECTION *conf, void **instance)
                inst->xlat_name = strdup(xlat_name);
                xlat_register(xlat_name, expr_xlat, inst);
        }
+       /*
+        * Initialize various paircompare functions
+        */
+       pair_builtincompare_init();
        *instance = inst;
 
        return 0;
@@ -293,6 +291,7 @@ static int expr_detach(void *instance)
        rlm_expr_t      *inst = instance;
 
        xlat_unregister(inst->xlat_name, expr_xlat);
+       pair_builtincompare_detach();
        free(inst->xlat_name);
 
        free(inst);
@@ -309,16 +308,15 @@ static int expr_detach(void *instance)
  *     is single-threaded.
  */
 module_t rlm_expr = {
+       RLM_MODULE_INIT,
        "expr",                         /* Name */
        RLM_TYPE_THREAD_SAFE,           /* type */
-       NULL,                           /* initialization */
        expr_instantiate,               /* instantiation */
+       expr_detach,                    /* detach */
        {
                NULL,                   /* authentication */
                NULL,                   /* authorization */
                NULL,                   /* pre-accounting */
                NULL                    /* accounting */
        },
-       expr_detach,                    /* detach */
-       NULL,                           /* destroy */
 };