summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2013-04-11 17:12:53 +0200
committerBadlop <badlop@process-one.net>2013-04-11 17:12:53 +0200
commitc7eaa9aeacaa3bb4493f43eb9ab62091b001eb1d (patch)
tree0e7290f7a120b8d22087ee8b145f3799af766d31
parentMerge pull request #57 from rraptorr/carboncopy (diff)
ejabberd 13 requires Erlang/OTP R15B or higher (EJAB-1630)
Fix documents and remove useless code.
Diffstat (limited to '')
-rw-r--r--README3
-rw-r--r--doc/guide.tex7
-rw-r--r--src/Makefile.in4
-rw-r--r--src/acinclude.m413
-rwxr-xr-xsrc/configure32
-rw-r--r--src/ejabberd_node_groups.erl4
-rw-r--r--src/eldap/Makefile.in1
-rw-r--r--src/pg2_backport.erl340
-rw-r--r--src/tls/Makefile.in1
-rw-r--r--src/web/Makefile.in1
-rw-r--r--src/web/mod_http_fileserver.erl16
-rw-r--r--src/xml.c30
12 files changed, 24 insertions, 428 deletions
diff --git a/README b/README
index bd54491f..fafd2ad3 100644
--- a/README
+++ b/README
@@ -9,8 +9,7 @@ To compile ejabberd you need:
- GNU Make
- GCC
- Libexpat 1.95 or higher
- - Erlang/OTP R10B-9 or higher. Recommended: R13B04 and R14B04.
- Avoid R14A and R14B.
+ - Erlang/OTP R15B or higher.
- OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption.
- Zlib 1.2.3 or higher, for Stream Compression support
(XEP-0138). Optional.
diff --git a/doc/guide.tex b/doc/guide.tex
index 36e943d6..e6151225 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -314,8 +314,7 @@ To compile \ejabberd{} on a `Unix-like' operating system, you need:
\item GNU Make
\item GCC
\item Libexpat 1.95 or higher
-\item Erlang/OTP R10B-9 or higher. The recommended versions are R13B04 and R14B04.
- Don't use R14A or R14B because \footahref{http://www.erlang.org/cgi-bin/ezmlm-cgi/4/54598}{they have a bug}.
+\item Erlang/OTP R15B or higher.
\item OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption.
\item Zlib 1.2.3 or higher, for Stream Compression support (\xepref{0138}). Optional.
\item Erlang mysql library. Optional. For MySQL authentication or storage. See section \ref{compilemysql}.
@@ -390,7 +389,6 @@ Some options that you may be interested in modifying:
\titem{--enable-nif}
Replaces some critical Erlang functions with equivalents written in C to improve performance.
- This feature requires Erlang/OTP R13B04 or higher.
\end{description}
\makesubsection{install}{Install}
@@ -5541,8 +5539,7 @@ In order for this communication to work,
\term{epmd} must be running and listening for name requests in the port 4369.
You should block the port 4369 in the firewall in such a way that
only the programs in your machine can access it.
-or configure the option \term{ERL\_EPMD\_ADDRESS} in the file \term{ejabberdctl.cfg}
-(this option works only in Erlang/OTP R14B03 or higher).
+or configure the option \term{ERL\_EPMD\_ADDRESS} in the file \term{ejabberdctl.cfg}.
If you build a cluster of several \ejabberd{} instances,
each \ejabberd{} instance is called an \ejabberd{} node.
diff --git a/src/Makefile.in b/src/Makefile.in
index 0b34d186..b5fd9a23 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -30,8 +30,8 @@ else
INIT_USER=$(INSTALLUSER)
endif
-EFLAGS += @ERLANG_SSLVER@ -pa .
-ERLANG_CFLAGS += @ERLANG_SSLVER@
+EFLAGS += -pa .
+ERLANG_CFLAGS +=
# make debug=true to compile Erlang module with debug informations.
ifdef debug
diff --git a/src/acinclude.m4 b/src/acinclude.m4
index 62b40ab2..79c226a6 100644
--- a/src/acinclude.m4
+++ b/src/acinclude.m4
@@ -126,17 +126,9 @@ start() ->
EIDirS = code:lib_dir("erl_interface") ++ "\n",
EILibS = libpath("erl_interface") ++ "\n",
RootDirS = code:root_dir() ++ "\n",
- file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ ssldef() ++ RootDirS)),
+ file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ RootDirS)),
halt().
-ssldef() ->
- OTP = (catch erlang:system_info(otp_release)),
- if
- OTP >= "R14" -> "-DSSL40\n";
- OTP >= "R12" -> "-DSSL39\n";
- true -> "\n"
- end.
-
%% return physical architecture based on OS/Processor
archname() ->
ArchStr = erlang:system_info(system_architecture),
@@ -184,8 +176,6 @@ _EOF
ERLANG_EI_DIR=`cat conftest.out | head -n 1`
# Second line
ERLANG_EI_LIB=`cat conftest.out | head -n 2 | tail -n 1`
- # Third line
- ERLANG_SSLVER=`cat conftest.out | head -n 3 | tail -n 1`
# End line
ERLANG_DIR=`cat conftest.out | tail -n 1`
@@ -194,7 +184,6 @@ _EOF
AC_SUBST(ERLANG_CFLAGS)
AC_SUBST(ERLANG_LIBS)
- AC_SUBST(ERLANG_SSLVER)
AC_SUBST(ERLC)
AC_SUBST(ERL)
])
diff --git a/src/configure b/src/configure
index 7b7066cb..031a731e 100755
--- a/src/configure
+++ b/src/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for ejabberd 2.1.12.
+# Generated by GNU Autoconf 2.68 for ejabberd 13.03-beta2.
#
# Report bugs to <ejabberd@process-one.net>.
#
@@ -560,8 +560,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ejabberd'
PACKAGE_TARNAME='ejabberd'
-PACKAGE_VERSION='2.1.12'
-PACKAGE_STRING='ejabberd 2.1.12'
+PACKAGE_VERSION='13.03-beta2'
+PACKAGE_STRING='ejabberd 13.03-beta2'
PACKAGE_BUGREPORT='ejabberd@process-one.net'
PACKAGE_URL=''
@@ -657,7 +657,6 @@ EGREP
GREP
CPP
LIBICONV
-ERLANG_SSLVER
ERLANG_LIBS
ERLANG_CFLAGS
ERL
@@ -1288,7 +1287,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ejabberd 2.1.12 to adapt to many kinds of systems.
+\`configure' configures ejabberd 13.03-beta2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1354,7 +1353,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ejabberd 2.1.12:";;
+ short | recursive ) echo "Configuration of ejabberd 13.03-beta2:";;
esac
cat <<\_ACEOF
@@ -1479,7 +1478,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ejabberd configure 2.1.12
+ejabberd configure 13.03-beta2
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1823,7 +1822,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ejabberd $as_me 2.1.12, which was
+It was created by ejabberd $as_me 13.03-beta2, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3224,17 +3223,9 @@ start() ->
EIDirS = code:lib_dir("erl_interface") ++ "\n",
EILibS = libpath("erl_interface") ++ "\n",
RootDirS = code:root_dir() ++ "\n",
- file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ ssldef() ++ RootDirS)),
+ file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ RootDirS)),
halt().
-ssldef() ->
- OTP = (catch erlang:system_info(otp_release)),
- if
- OTP >= "R14" -> "-DSSL40\n";
- OTP >= "R12" -> "-DSSL39\n";
- true -> "\n"
- end.
-
%% return physical architecture based on OS/Processor
archname() ->
ArchStr = erlang:system_info(system_architecture),
@@ -3282,8 +3273,6 @@ _EOF
ERLANG_EI_DIR=`cat conftest.out | head -n 1`
# Second line
ERLANG_EI_LIB=`cat conftest.out | head -n 2 | tail -n 1`
- # Third line
- ERLANG_SSLVER=`cat conftest.out | head -n 3 | tail -n 1`
# End line
ERLANG_DIR=`cat conftest.out | tail -n 1`
@@ -3295,7 +3284,6 @@ _EOF
-
#locating iconv
@@ -5690,7 +5678,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ejabberd $as_me 2.1.12, which was
+This file was extended by ejabberd $as_me 13.03-beta2, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5743,7 +5731,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ejabberd config.status 2.1.12
+ejabberd config.status 13.03-beta2
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/src/ejabberd_node_groups.erl b/src/ejabberd_node_groups.erl
index 371a1bc2..4e0335b9 100644
--- a/src/ejabberd_node_groups.erl
+++ b/src/ejabberd_node_groups.erl
@@ -40,11 +40,7 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
--ifdef(SSL40).
-define(PG2, pg2).
--else.
--define(PG2, pg2_backport).
--endif.
-record(state, {}).
diff --git a/src/eldap/Makefile.in b/src/eldap/Makefile.in
index a44bee59..6d895eec 100644
--- a/src/eldap/Makefile.in
+++ b/src/eldap/Makefile.in
@@ -11,7 +11,6 @@ ASN_FLAGS = -bber_bin +optimize +binary_strings
ERLANG_CFLAGS = @ERLANG_CFLAGS@
ERLANG_LIBS = @ERLANG_LIBS@
-EFLAGS += @ERLANG_SSLVER@
EFLAGS += -I ..
EFLAGS += -pz ..
diff --git a/src/pg2_backport.erl b/src/pg2_backport.erl
deleted file mode 100644
index faa77552..00000000
--- a/src/pg2_backport.erl
+++ /dev/null
@@ -1,340 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2011. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
--module(pg2_backport).
-
--export([create/1, delete/1, join/2, leave/2]).
--export([get_members/1, get_local_members/1]).
--export([get_closest_pid/1, which_groups/0]).
--export([start/0,start_link/0,init/1,handle_call/3,handle_cast/2,handle_info/2,
- terminate/2]).
-
-%%% As of R13B03 monitors are used instead of links.
-
-%%%
-%%% Exported functions
-%%%
-
-start_link() ->
- gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
-
-start() ->
- ensure_started().
-
-create(Name) ->
- ensure_started(),
- case ets:member(pg2_table, {group, Name}) of
- false ->
- global:trans({{?MODULE, Name}, self()},
- fun() ->
- gen_server:multi_call(?MODULE, {create, Name})
- end),
- ok;
- true ->
- ok
- end.
-
-delete(Name) ->
- ensure_started(),
- global:trans({{?MODULE, Name}, self()},
- fun() ->
- gen_server:multi_call(?MODULE, {delete, Name})
- end),
- ok.
-
-join(Name, Pid) when is_pid(Pid) ->
- ensure_started(),
- case ets:member(pg2_table, {group, Name}) of
- false ->
- {error, {no_such_group, Name}};
- true ->
- global:trans({{?MODULE, Name}, self()},
- fun() ->
- gen_server:multi_call(?MODULE,
- {join, Name, Pid})
- end),
- ok
- end.
-
-leave(Name, Pid) when is_pid(Pid) ->
- ensure_started(),
- case ets:member(pg2_table, {group, Name}) of
- false ->
- {error, {no_such_group, Name}};
- true ->
- global:trans({{?MODULE, Name}, self()},
- fun() ->
- gen_server:multi_call(?MODULE,
- {leave, Name, Pid})
- end),
- ok
- end.
-
-get_members(Name) ->
- ensure_started(),
- case ets:member(pg2_table, {group, Name}) of
- true ->
- group_members(Name);
- false ->
- {error, {no_such_group, Name}}
- end.
-
-get_local_members(Name) ->
- ensure_started(),
- case ets:member(pg2_table, {group, Name}) of
- true ->
- local_group_members(Name);
- false ->
- {error, {no_such_group, Name}}
- end.
-
-which_groups() ->
- ensure_started(),
- all_groups().
-
-get_closest_pid(Name) ->
- case get_local_members(Name) of
- [Pid] ->
- Pid;
- [] ->
- {_,_,X} = erlang:now(),
- case get_members(Name) of
- [] -> {error, {no_process, Name}};
- Members ->
- lists:nth((X rem length(Members))+1, Members)
- end;
- Members when is_list(Members) ->
- {_,_,X} = erlang:now(),
- lists:nth((X rem length(Members))+1, Members);
- Else ->
- Else
- end.
-
-%%%
-%%% Callback functions from gen_server
-%%%
-
--record(state, {}).
-
-init([]) ->
- Ns = nodes(),
- net_kernel:monitor_nodes(true),
- lists:foreach(fun(N) ->
- {?MODULE, N} ! {new_pg2, node()},
- self() ! {nodeup, N}
- end, Ns),
- pg2_table = ets:new(pg2_table, [ordered_set, protected, named_table]),
- {ok, #state{}}.
-
-handle_call({create, Name}, _From, S) ->
- assure_group(Name),
- {reply, ok, S};
-handle_call({join, Name, Pid}, _From, S) ->
- ets:member(pg2_table, {group, Name}) andalso join_group(Name, Pid),
- {reply, ok, S};
-handle_call({leave, Name, Pid}, _From, S) ->
- ets:member(pg2_table, {group, Name}) andalso leave_group(Name, Pid),
- {reply, ok, S};
-handle_call({delete, Name}, _From, S) ->
- delete_group(Name),
- {reply, ok, S};
-handle_call(Request, From, S) ->
- error_logger:warning_msg("The pg2 server received an unexpected message:\n"
- "handle_call(~p, ~p, _)\n",
- [Request, From]),
- {noreply, S}.
-
-handle_cast({exchange, _Node, List}, S) ->
- store(List),
- {noreply, S};
-handle_cast(_, S) ->
- %% Ignore {del_member, Name, Pid}.
- {noreply, S}.
-
-handle_info({'DOWN', MonitorRef, process, _Pid, _Info}, S) ->
- member_died(MonitorRef),
- {noreply, S};
-handle_info({nodeup, Node}, S) ->
- gen_server:cast({?MODULE, Node}, {exchange, node(), all_members()}),
- {noreply, S};
-handle_info({new_pg2, Node}, S) ->
- gen_server:cast({?MODULE, Node}, {exchange, node(), all_members()}),
- {noreply, S};
-handle_info(_, S) ->
- {noreply, S}.
-
-terminate(_Reason, _S) ->
- true = ets:delete(pg2_table),
- ok.
-
-%%%
-%%% Local functions
-%%%
-
-%%% One ETS table, pg2_table, is used for bookkeeping. The type of the
-%%% table is ordered_set, and the fast matching of partially
-%%% instantiated keys is used extensively.
-%%%
-%%% {{group, Name}}
-%%% Process group Name.
-%%% {{ref, Pid}, RPid, MonitorRef, Counter}
-%%% {{ref, MonitorRef}, Pid}
-%%% Each process has one monitor. Sometimes a process is spawned to
-%%% monitor the pid (RPid). Counter is incremented when the Pid joins
-%%% some group.
-%%% {{member, Name, Pid}, GroupCounter}
-%%% {{local_member, Name, Pid}}
-%%% Pid is a member of group Name, GroupCounter is incremented when the
-%%% Pid joins the group Name.
-%%% {{pid, Pid, Name}}
-%%% Pid is a member of group Name.
-
-store(List) ->
- _ = [(assure_group(Name)
- andalso
- store2(Name, Members)) ||
- [Name, Members] <- List],
- ok.
-store2(Name, Members) ->
- [join_group(Name, P) || P <- Members -- group_members(Name)],
- true.
-
-assure_group(Name) ->
- Key = {group, Name},
- ets:member(pg2_table, Key) orelse true =:= ets:insert(pg2_table, {Key}).
-
-delete_group(Name) ->
- _ = [leave_group(Name, Pid) || Pid <- group_members(Name)],
- true = ets:delete(pg2_table, {group, Name}),
- ok.
-
-member_died(Ref) ->
- [{{ref, Ref}, Pid}] = ets:lookup(pg2_table, {ref, Ref}),
- Names = member_groups(Pid),
- _ = [leave_group(Name, P) ||
- Name <- Names,
- P <- member_in_group(Pid, Name)],
- %% Kept for backward compatibility with links. Can be removed, eventually.
- _ = [gen_server:abcast(nodes(), ?MODULE, {del_member, Name, Pid}) ||
- Name <- Names],
- ok.
-
-join_group(Name, Pid) ->
- Ref_Pid = {ref, Pid},
- try _ = ets:update_counter(pg2_table, Ref_Pid, {4, +1})
- catch _:_ ->
- {RPid, Ref} = do_monitor(Pid),
- true = ets:insert(pg2_table, {Ref_Pid, RPid, Ref, 1}),
- true = ets:insert(pg2_table, {{ref, Ref}, Pid})
- end,
- Member_Name_Pid = {member, Name, Pid},
- try _ = ets:update_counter(pg2_table, Member_Name_Pid, {2, +1})
- catch _:_ ->
- true = ets:insert(pg2_table, {Member_Name_Pid, 1}),
- _ = [ets:insert(pg2_table, {{local_member, Name, PidX}}) ||
- PidX <- [Pid],
- node(PidX) =:= node()],
- true = ets:insert(pg2_table, {{pid, Pid, Name}})
- end.
-
-leave_group(Name, Pid) ->
- Member_Name_Pid = {member, Name, Pid},
- try ets:update_counter(pg2_table, Member_Name_Pid, {2, -1}) of
- N ->
- if
- N =:= 0 ->
- true = ets:delete(pg2_table, {pid, Pid, Name}),
- _ = [ets:delete(pg2_table, {local_member, Name, PidX}) ||
- PidX <- [Pid],
- node(PidX) =:= node()],
- true = ets:delete(pg2_table, Member_Name_Pid);
- true ->
- ok
- end,
- Ref_Pid = {ref, Pid},
- case ets:update_counter(pg2_table, Ref_Pid, {4, -1}) of
- 0 ->
- [{Ref_Pid,RPid,Ref,0}] = ets:lookup(pg2_table, Ref_Pid),
- true = ets:delete(pg2_table, {ref, Ref}),
- true = ets:delete(pg2_table, Ref_Pid),
- true = erlang:demonitor(Ref, [flush]),
- kill_monitor_proc(RPid, Pid);
- _ ->
- ok
- end
- catch _:_ ->
- ok
- end.
-
-all_members() ->
- [[G, group_members(G)] || G <- all_groups()].
-
-group_members(Name) ->
- [P ||
- [P, N] <- ets:match(pg2_table, {{member, Name, '$1'},'$2'}),
- _ <- lists:seq(1, N)].
-
-local_group_members(Name) ->
- [P ||
- [Pid] <- ets:match(pg2_table, {{local_member, Name, '$1'}}),
- P <- member_in_group(Pid, Name)].
-
-member_in_group(Pid, Name) ->
- case ets:lookup(pg2_table, {member, Name, Pid}) of
- [] -> [];
- [{{member, Name, Pid}, N}] ->
- lists:duplicate(N, Pid)
- end.
-
-member_groups(Pid) ->
- [Name || [Name] <- ets:match(pg2_table, {{pid, Pid, '$1'}})].
-
-all_groups() ->
- [N || [N] <- ets:match(pg2_table, {{group,'$1'}})].
-
-ensure_started() ->
- case whereis(?MODULE) of
- undefined ->
- C = {pg2, {?MODULE, start_link, []}, permanent,
- 1000, worker, [?MODULE]},
- supervisor:start_child(kernel_safe_sup, C);
- Pg2Pid ->
- {ok, Pg2Pid}
- end.
-
-
-kill_monitor_proc(RPid, Pid) ->
- RPid =:= Pid orelse exit(RPid, kill).
-
-%% When/if erlang:monitor() returns before trying to connect to the
-%% other node this function can be removed.
-do_monitor(Pid) ->
- case (node(Pid) =:= node()) orelse lists:member(node(Pid), nodes()) of
- true ->
- %% Assume the node is still up
- {Pid, erlang:monitor(process, Pid)};
- false ->
- F = fun() ->
- Ref = erlang:monitor(process, Pid),
- receive
- {'DOWN', Ref, process, Pid, _Info} ->
- exit(normal)
- end
- end,
- erlang:spawn_monitor(F)
- end.
diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in
index 203c88ac..ab5e32df 100644
--- a/src/tls/Makefile.in
+++ b/src/tls/Makefile.in
@@ -21,7 +21,6 @@ ifeq ($(shell uname),SunOs)
DYNAMIC_LIB_CFLAGS = -KPIC -G -z text
endif
-EFLAGS += @ERLANG_SSLVER@
EFLAGS += -I ..
EFLAGS += -pz ..
diff --git a/src/web/Makefile.in b/src/web/Makefile.in
index 5ac2fe5e..151f4c47 100644
--- a/src/web/Makefile.in
+++ b/src/web/Makefile.in
@@ -9,7 +9,6 @@ LIBS = @LIBS@
ERLANG_CFLAGS = @ERLANG_CFLAGS@
ERLANG_LIBS = @ERLANG_LIBS@
-EFLAGS += @ERLANG_SSLVER@
EFLAGS += -I ..
EFLAGS += -pz ..
diff --git a/src/web/mod_http_fileserver.erl b/src/web/mod_http_fileserver.erl
index 8fe0c0fc..559ff48c 100644
--- a/src/web/mod_http_fileserver.erl
+++ b/src/web/mod_http_fileserver.erl
@@ -59,24 +59,8 @@
{method, path, q = [], us, auth, lang = <<"">>,
data = <<"">>, ip, host, port, tp, headers}).
--ifdef(SSL40).
-
--define(STRING2LOWER, string).
-
--else.
-
--ifdef(SSL39).
-
-define(STRING2LOWER, string).
--else.
-
--define(STRING2LOWER, httpd_util).
-
--endif.
-
--endif.
-
-record(state,
{host, docroot, accesslog, accesslogfd,
directory_indices, custom_headers, default_content_type,
diff --git a/src/xml.c b/src/xml.c
index 0a600e9f..583060c1 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -2,20 +2,6 @@
#include <string.h>
#include <stdio.h>
-#ifdef SSL40
-#define ENIF_ALLOC(SIZE) enif_alloc(SIZE)
-#define ENIF_FREE(PTR) enif_free(PTR)
-#define ENIF_REALLOC(PTR, SIZE) enif_realloc(PTR, SIZE)
-#define ENIF_ALLOC_BINARY(SIZE, BIN) enif_alloc_binary(SIZE, BIN)
-#define ENIF_COMPARE(TERM1, TERM2) enif_compare(TERM1, TERM2)
-#else
-#define ENIF_ALLOC(SIZE) enif_alloc(env, SIZE)
-#define ENIF_FREE(PTR) enif_free(env, PTR)
-#define ENIF_REALLOC(PTR, SIZE) enif_realloc(env, PTR, SIZE)
-#define ENIF_ALLOC_BINARY(SIZE, BIN) enif_alloc_binary(env, SIZE, BIN)
-#define ENIF_COMPARE(TERM1, TERM2) enif_compare(env, TERM1, TERM2)
-#endif
-
static ERL_NIF_TERM atom_xmlelement;
static ERL_NIF_TERM atom_xmlcdata;
@@ -36,10 +22,10 @@ static int load(ErlNifEnv* env, void** priv, ERL_NIF_TERM load_info)
static struct buf *init_buf(ErlNifEnv* env)
{
- struct buf *rbuf = ENIF_ALLOC(sizeof(struct buf));
+ struct buf *rbuf = enif_alloc(sizeof(struct buf));
rbuf->limit = 1024;
rbuf->len = 0;
- rbuf->b = ENIF_ALLOC(rbuf->limit);
+ rbuf->b = enif_alloc(rbuf->limit);
return rbuf;
}
@@ -47,9 +33,9 @@ static void destroy_buf(ErlNifEnv* env, struct buf *rbuf)
{
if (rbuf) {
if (rbuf->b) {
- ENIF_FREE(rbuf->b);
+ enif_free(rbuf->b);
};
- ENIF_FREE(rbuf);
+ enif_free(rbuf);
};
}
@@ -60,7 +46,7 @@ inline void resize_buf(ErlNifEnv* env, struct buf *rbuf, int len_to_add)
if (new_len > rbuf->limit) {
while (new_len > rbuf->limit)
rbuf->limit *= 2;
- rbuf->b = ENIF_REALLOC(rbuf->b, rbuf->limit);
+ rbuf->b = enif_realloc(rbuf->b, rbuf->limit);
}
}
@@ -166,7 +152,7 @@ static int make_element(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM el)
if (enif_get_tuple(env, el, &arity, &tuple)) {
if (arity == 2) {
- if (!ENIF_COMPARE(tuple[0], atom_xmlcdata)) {
+ if (!enif_compare(tuple[0], atom_xmlcdata)) {
if (enif_inspect_iolist_as_binary(env, tuple[1], &cdata)) {
crypt(env, rbuf, cdata.data, cdata.size);
ret = 1;
@@ -174,7 +160,7 @@ static int make_element(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM el)
};
};
if (arity == 4) {
- if (!ENIF_COMPARE(tuple[0], atom_xmlelement)) {
+ if (!enif_compare(tuple[0], atom_xmlelement)) {
if (enif_inspect_iolist_as_binary(env, tuple[1], &name)) {
buf_add_char(env, rbuf, '<');
buf_add_str(env, rbuf, (char *)name.data, name.size);
@@ -217,7 +203,7 @@ static ERL_NIF_TERM element_to(ErlNifEnv* env, int argc,
destroy_buf(env, rbuf);
return result;
} else {
- if (ENIF_ALLOC_BINARY(rbuf->len, &output)) {
+ if (enif_alloc_binary(rbuf->len, &output)) {
memcpy(output.data, rbuf->b, rbuf->len);
result = enif_make_binary(env, &output);
destroy_buf(env, rbuf);