aboutsummaryrefslogtreecommitdiff
path: root/src/xml.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2010-07-01 20:54:01 +1000
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2010-07-01 20:54:01 +1000
commit715cc5ea3bf01ea99b2516c0d3d48e2a5ccb8174 (patch)
tree3e38ad6059a757be34cafe3d80c55c0aa922387b /src/xml.erl
parentFix privacy check when serving local Last (thanks to Brian Acton)(EJAB-1271) (diff)
New configure option: --enable-nif
Diffstat (limited to 'src/xml.erl')
-rw-r--r--src/xml.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/xml.erl b/src/xml.erl
index 9a9a7f833..22746b10a 100644
--- a/src/xml.erl
+++ b/src/xml.erl
@@ -37,8 +37,11 @@
get_subtag/2, get_subtag_cdata/2,
append_subtags/2,
get_path_s/2,
+ start/0,
replace_tag_attr/3]).
+-include("ejabberd.hrl").
+
%% Select at compile time how to escape characters in binary text
%% nodes.
%% Can be choosen with ./configure --enable-full-xml
@@ -48,6 +51,22 @@
-define(ESCAPE_BINARY(CData), crypt(CData)).
-endif.
+%% Replace element_to_binary/1 with NIF
+%% Can be choosen with ./configure --enable-nif
+-ifdef(NIF).
+start() ->
+ SOPath = filename:join(ejabberd:get_so_path(), "xml"),
+ case catch erlang:load_nif(SOPath, 0) of
+ ok ->
+ ok;
+ Err ->
+ ?WARNING_MSG("unable to load xml NIF: ~p", [Err])
+ end.
+-else.
+start() ->
+ ok.
+-endif.
+
element_to_binary(El) ->
iolist_to_binary(element_to_string(El)).