Merge pull request #1 from vkatsuba/fix/warning_failed_to_boot_redis

Fix warnings
This commit is contained in:
Mathieu Kerjouan
2021-04-07 18:17:43 +00:00
committed by GitHub
4 changed files with 21 additions and 16 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ _build
.idea
rebar3.crashdump
**~
rebar3

View File

@@ -1,7 +1,2 @@
{erl_opts, [debug_info]}.
{deps, []}.
{shell, [
% {config, "config/sys.config"},
{apps, [redis]}
]}.

9
src/redis.app.src Normal file
View File

@@ -0,0 +1,9 @@
{application, redis,
[{description, "redis is an application and library implementing redis protocol in Erlang"},
{vsn, semver},
{registered, []},
{env, []},
{applications, [kernel, stdlib]},
{licenses, ["ISC License"]},
{links, [{"Github", "https://github.com/niamtokik/redis.git"}]}]
}.

View File

@@ -6,10 +6,10 @@
-export([encode/1, decode/1]).
-include_lib("eunit/include/eunit.hrl").
-type encode_error() :: {error, bitstring() | binary()}.
%-type encode_error() :: {error, bitstring() | binary()}.
-type encode_integer() :: integer().
-type encode_string() :: bitstring() | binary().
-type encode_bulk_string() :: {bulk_string, bitstring()}.
-type encode_bulk_string() :: {bulk_string, bitstring() | null} | list() | {error, binary()}.
-type encode_array() :: [encode_integer() |
encode_string() |
encode_bulk_string()].
@@ -128,7 +128,7 @@ encode_valid_char(Bitstring)
List :: list(),
Buffer :: bitstring() | binary(),
Counter :: integer(),
Return :: bitstring() | binary().
Return :: {ok, bitstring() | binary(), integer()}.
encode_array([], Buffer, Counter) ->
{ok, Buffer, Counter};
encode_array([H|T], Buffer, Counter) ->
@@ -211,12 +211,12 @@ decode_integer(<<Char, Rest/bitstring>>, Buffer)
%%--------------------------------------------------------------------
%%
%%--------------------------------------------------------------------
decode_separator(Bitstring) ->
case binary:split(Bitstring, <<"\r\n">>) of
[<<>>] -> {ok, <<>>};
[<<>>,<<>>] -> {ok, <<>>};
[Value,Rest] -> {ok, Value, Rest}
end.
%decode_separator(Bitstring) ->
% case binary:split(Bitstring, <<"\r\n">>) of
% [<<>>] -> {ok, <<>>};
% [<<>>,<<>>] -> {ok, <<>>};
% [Value,Rest] -> {ok, Value, Rest}
% end.
%%--------------------------------------------------------------------
%%
@@ -265,9 +265,9 @@ decode_error(Bitstring) ->
decode_error(<<"\r\n">>, Buffer) ->
{ok, {error, Buffer}};
decode_error(<<"\r", Rest/bitstring>>, _) ->
decode_error(<<"\r", _/bitstring>>, _) ->
{error, badchar};
decode_error(<<"\n", Rest/bitstring>>, _) ->
decode_error(<<"\n", _/bitstring>>, _) ->
{error, badchar};
decode_error(<<Char, Rest/bitstring>>, Buffer) ->
decode_error(Rest, <<Buffer/bitstring, Char>>).