erlang: Separate out thrift_protocol:read_specific
By giving a different name to the function that reads from the
protocol implementation, we can get a slightly more enforcible spec.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@990977 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/include/thrift_protocol_impl.hrl b/lib/erl/include/thrift_protocol_impl.hrl
index 92f3a00..ae0f0f7 100644
--- a/lib/erl/include/thrift_protocol_impl.hrl
+++ b/lib/erl/include/thrift_protocol_impl.hrl
@@ -27,7 +27,7 @@
-spec write(state(), term()) -> ok | {error, _Reason}.
-%% NOTE: Keep this in sync with thrift_protocol:read.
+%% NOTE: Keep this in sync with thrift_protocol:read and read_specific.
-spec read
(state(), tprot_empty_tag()) -> ok | {error, _Reason};
(state(), tprot_header_tag()) -> tprot_header_val() | {error, _Reason};
diff --git a/lib/erl/src/thrift_protocol.erl b/lib/erl/src/thrift_protocol.erl
index a207bca..3da526c 100644
--- a/lib/erl/src/thrift_protocol.erl
+++ b/lib/erl/src/thrift_protocol.erl
@@ -158,8 +158,16 @@
ok = read(IProto, set_end),
{ok, sets:from_list(List)};
-read(#protocol{module = Module,
- data = ModuleData}, ProtocolType) ->
+read(Protocol, ProtocolType) ->
+ read_specific(Protocol, ProtocolType).
+
+%% NOTE: Keep this in sync with thrift_protocol_impl:read
+-spec read_specific
+ (#protocol{}, tprot_empty_tag()) -> ok | {error, _Reason};
+ (#protocol{}, tprot_header_tag()) -> tprot_header_val() | {error, _Reason};
+ (#protocol{}, tprot_data_tag()) -> {ok, term()} | {error, _Reason}.
+read_specific(#protocol{module = Module,
+ data = ModuleData}, ProtocolType) ->
Module:read(ModuleData, ProtocolType).
read_struct_loop(IProto, SDict, RTuple) ->