diff --git a/sql/item_func.cc b/sql/item_func.cc
index 5227e7711940ed5ced42b4d39fc8ee406d5155fd..1d906b300b6a306aae4f8d2d98c69f1399a78fc9 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2510,8 +2510,7 @@ void udf_handler::cleanup()
     {
       if (u_d->func_deinit != NULL)
       {
-        void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*))
-        u_d->func_deinit;
+        Udf_func_deinit deinit= u_d->func_deinit;
         (*deinit)(&initid);
       }
       free_udf(u_d);
@@ -2656,9 +2655,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
       }
     }
     thd->net.last_error[0]=0;
-    my_bool (*init)(UDF_INIT *, UDF_ARGS *, char *)=
-      (my_bool (*)(UDF_INIT *, UDF_ARGS *,  char *))
-      u_d->func_init;
+    Udf_func_init init= u_d->func_init;
     if ((error=(uchar) init(&initid, &f_args, thd->net.last_error)))
     {
       my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 95589a58b37cf707165cfad7e6b7701da5f39c2b..8f98bab5c04cd5b4232ec047220bd6dee444de45 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -83,7 +83,7 @@ static char *init_syms(udf_func *tmp, char *nm)
 {
   char *end;
 
-  if (!((tmp->func= dlsym(tmp->dlhandle, tmp->name.str))))
+  if (!((tmp->func= (Udf_func_any) dlsym(tmp->dlhandle, tmp->name.str))))
     return tmp->name.str;
 
   end=strmov(nm,tmp->name.str);
@@ -91,18 +91,18 @@ static char *init_syms(udf_func *tmp, char *nm)
   if (tmp->type == UDFTYPE_AGGREGATE)
   {
     (void)strmov(end, "_clear");
-    if (!((tmp->func_clear= dlsym(tmp->dlhandle, nm))))
+    if (!((tmp->func_clear= (Udf_func_clear) dlsym(tmp->dlhandle, nm))))
       return nm;
     (void)strmov(end, "_add");
-    if (!((tmp->func_add= dlsym(tmp->dlhandle, nm))))
+    if (!((tmp->func_add= (Udf_func_add) dlsym(tmp->dlhandle, nm))))
       return nm;
   }
 
   (void) strmov(end,"_deinit");
-  tmp->func_deinit= dlsym(tmp->dlhandle, nm);
+  tmp->func_deinit= (Udf_func_deinit) dlsym(tmp->dlhandle, nm);
 
   (void) strmov(end,"_init");
-  tmp->func_init= dlsym(tmp->dlhandle, nm);
+  tmp->func_init= (Udf_func_init) dlsym(tmp->dlhandle, nm);
 
   /*
     to prefent loading "udf" from, e.g. libc.so
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index d0729deecaa381adeabe4f637633f4f040dbf111..21cf735f5ab8f3d76cfbfb84bfd16e3cb4779f01 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -23,6 +23,15 @@
 
 enum Item_udftype {UDFTYPE_FUNCTION=1,UDFTYPE_AGGREGATE};
 
+typedef void (*Udf_func_clear)(UDF_INIT *, uchar *, uchar *);
+typedef void (*Udf_func_add)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *);
+typedef void (*Udf_func_deinit)(UDF_INIT*);
+typedef my_bool (*Udf_func_init)(UDF_INIT *, UDF_ARGS *,  char *);
+typedef void (*Udf_func_any)();
+typedef double (*Udf_func_double)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *);
+typedef longlong (*Udf_func_longlong)(UDF_INIT *, UDF_ARGS *, uchar *,
+                                      uchar *);
+
 typedef struct st_udf_func
 {
   LEX_STRING name;
@@ -30,11 +39,11 @@ typedef struct st_udf_func
   Item_udftype type;
   char *dl;
   void *dlhandle;
-  void *func;
-  void *func_init;
-  void *func_deinit;
-  void *func_clear;
-  void *func_add;
+  Udf_func_any func;
+  Udf_func_init func_init;
+  Udf_func_deinit func_deinit;
+  Udf_func_clear func_clear;
+  Udf_func_add func_add;
   ulong usage_count;
 } udf_func;
 
@@ -76,8 +85,7 @@ class udf_handler :public Sql_alloc
       *null_value=1;
       return 0.0;
     }
-    double (*func)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)=
-      (double (*)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)) u_d->func;
+    Udf_func_double func= (Udf_func_double) u_d->func;
     double tmp=func(&initid, &f_args, &is_null, &error);
     if (is_null || error)
     {
@@ -95,8 +103,7 @@ class udf_handler :public Sql_alloc
       *null_value=1;
       return LL(0);
     }
-    longlong (*func)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)=
-      (longlong (*)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)) u_d->func;
+    Udf_func_longlong func= (Udf_func_longlong) u_d->func;
     longlong tmp=func(&initid, &f_args, &is_null, &error);
     if (is_null || error)
     {
@@ -110,8 +117,7 @@ class udf_handler :public Sql_alloc
   void clear()
   {
     is_null= 0;
-    void (*func)(UDF_INIT *, uchar *, uchar *)=
-    (void (*)(UDF_INIT *, uchar *, uchar *)) u_d->func_clear;
+    Udf_func_clear func= u_d->func_clear;
     func(&initid, &is_null, &error);
   }
   void add(my_bool *null_value)
@@ -121,8 +127,7 @@ class udf_handler :public Sql_alloc
       *null_value=1;
       return;
     }
-    void (*func)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)=
-    (void (*)(UDF_INIT *, UDF_ARGS *, uchar *, uchar *)) u_d->func_add;
+    Udf_func_add func= u_d->func_add;
     func(&initid, &f_args, &is_null, &error);
     *null_value= (my_bool) (is_null || error);
   }