You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/12/05 13:13:59 UTC

[GitHub] [couchdb] big-r81 opened a new pull request, #4289: Fix unbound variable warning

big-r81 opened a new pull request, #4289:
URL: https://github.com/apache/couchdb/pull/4289

   ## Overview
   
   While the variable `RelativeFileName` is not really unbound in the case-statement, use a 
   more up-to-date pattern for binding the value.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on a diff in pull request #4289: Fix unbound variable warning

Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4289:
URL: https://github.com/apache/couchdb/pull/4289#discussion_r1039713337


##########
src/couch/src/couch_server.erl:
##########
@@ -416,10 +416,11 @@ all_databases(Fun, Acc0) ->
                 true,
                 fun(Filename, AccIn) ->
                     NormFilename = couch_util:normpath(Filename),
-                    case NormFilename -- NormRoot of
-                        [$/ | RelativeFilename] -> ok;
-                        RelativeFilename -> ok
-                    end,
+                    RelativeFilename =
+                        case NormFilename -- NormRoot of
+                            [$/ | Filename] -> Filename;

Review Comment:
   We don't want to use `Filename` as that will have to match with already bound `Filename` from `fun(Filename, AccIn)`. Inside case clauses, we can just use a shorted variable if there is minimal chance collision, so something like `FN` perhaps?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] big-r81 commented on a diff in pull request #4289: Fix unbound variable warning

Posted by GitBox <gi...@apache.org>.
big-r81 commented on code in PR #4289:
URL: https://github.com/apache/couchdb/pull/4289#discussion_r1039717917


##########
src/couch/src/couch_server.erl:
##########
@@ -416,10 +416,11 @@ all_databases(Fun, Acc0) ->
                 true,
                 fun(Filename, AccIn) ->
                     NormFilename = couch_util:normpath(Filename),
-                    case NormFilename -- NormRoot of
-                        [$/ | RelativeFilename] -> ok;
-                        RelativeFilename -> ok
-                    end,
+                    RelativeFilename =
+                        case NormFilename -- NormRoot of
+                            [$/ | Filename] -> Filename;

Review Comment:
   Ohhhh, I totally overlooked that! Of course, that won't work! Will fix this!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] big-r81 merged pull request #4289: Fix unbound variable warning

Posted by GitBox <gi...@apache.org>.
big-r81 merged PR #4289:
URL: https://github.com/apache/couchdb/pull/4289


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org