couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: Reuse mochihex:to_bin/1 for couch_util:from_hex/1
Date Mon, 19 Mar 2012 04:24:29 GMT
Updated Branches:
  refs/heads/COUCHDB-1445 da3ed1bf3 -> 963f9112e


Reuse mochihex:to_bin/1 for couch_util:from_hex/1


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/963f9112
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/963f9112
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/963f9112

Branch: refs/heads/COUCHDB-1445
Commit: 963f9112e17da6c722d8dec91bdeec1101fa44b6
Parents: da3ed1b
Author: Paul Joseph Davis <davisp@apache.org>
Authored: Sun Mar 18 23:23:15 2012 -0500
Committer: Paul Joseph Davis <davisp@apache.org>
Committed: Sun Mar 18 23:23:15 2012 -0500

----------------------------------------------------------------------
 src/couchdb/couch_util.erl       |    9 +++------
 src/couchdb/couch_view_group.erl |    2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/963f9112/src/couchdb/couch_util.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl
index 6c5e981..f229760 100644
--- a/src/couchdb/couch_util.erl
+++ b/src/couchdb/couch_util.erl
@@ -136,13 +136,10 @@ to_hex([H|T]) ->
 to_digit(N) when N < 10 -> $0 + N;
 to_digit(N)             -> $a + N-10.
 
+from_hex(Hex) when is_binary(Hex) ->
+    mochihex:to_bin(?b2l(Hex));
 from_hex(Hex) when is_list(Hex) ->
-    from_hex(?l2b(Hex));
-from_hex(<<>>) ->
-    [];
-from_hex(<<Digit:2/binary,Rest/binary>>) ->
-    {ok, [N], []} = io_lib:fread("~16u", ?b2l(Digit)),
-    [N|from_hex(Rest)].
+    mochihex:to_bin(Hex).
 
 
 parse_term(Bin) when is_binary(Bin) ->

http://git-wip-us.apache.org/repos/asf/couchdb/blob/963f9112/src/couchdb/couch_view_group.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl
index 52185ba..17fcca0 100644
--- a/src/couchdb/couch_view_group.erl
+++ b/src/couchdb/couch_view_group.erl
@@ -463,7 +463,7 @@ design_root(RootDir, DbName) ->
 
 index_file_name(RootDir, DBName, Pid) when is_pid(Pid) ->
     {ok, GroupInfo} = request_group_info(Pid),
-    GroupSig = ?l2b(couch_util:from_hex(couch_util:get_value(signature, GroupInfo))),
+    GroupSig = couch_util:from_hex(couch_util:get_value(signature, GroupInfo)),
     index_file_name(RootDir, DBName, GroupSig);
 index_file_name(RootDir, DbName, GroupSig) ->
     design_root(RootDir, DbName) ++ hex_sig(GroupSig) ++".view".


Mime
View raw message