when is_list_of_lists?
On Wed, Feb 2, 2011 at 2:36 PM, Robert Newson <[email protected]> wrote: > Ack, thanks. will fix (again) > > On Wed, Feb 2, 2011 at 7:17 PM, Filipe David Manana <[email protected]> > wrote: >> Robert, >> >>> - [User | Pass] -> >>> + [User | Pass] when is_list(Pass) -> >>> {User, string:join(Pass, ":")}; >>> [User] -> >>> {User, ""}; >> >> "Pass" will always be a list. The clause with a single element match >> is the redundant one. Calling string:join(":") on an emply list/string >> will return an empty list/string, so the [User] clause could go away. >> >> cheers >> >> On Wed, Feb 2, 2011 at 2:26 AM, <[email protected]> wrote: >>> Author: rnewson >>> Date: Wed Feb 2 10:26:43 2011 >>> New Revision: 1066404 >>> >>> URL: http://svn.apache.org/viewvc?rev=1066404&view=rev >>> Log: >>> fix clause warning introduced with COUCHDB-969 >>> >>> Modified: >>> couchdb/branches/1.1.x/src/couchdb/couch_httpd_auth.erl >>> >>> Modified: couchdb/branches/1.1.x/src/couchdb/couch_httpd_auth.erl >>> URL: >>> http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_httpd_auth.erl?rev=1066404&r1=1066403&r2=1066404&view=diff >>> ============================================================================== >>> --- couchdb/branches/1.1.x/src/couchdb/couch_httpd_auth.erl (original) >>> +++ couchdb/branches/1.1.x/src/couchdb/couch_httpd_auth.erl Wed Feb 2 >>> 10:26:43 2011 >>> @@ -53,7 +53,7 @@ basic_name_pw(Req) -> >>> nil; >>> [User, Pass] -> >>> {User, Pass}; >>> - [User | Pass] -> >>> + [User | Pass] when is_list(Pass) -> >>> {User, string:join(Pass, ":")}; >>> [User] -> >>> {User, ""}; >>> >>> >>> >> >> >> >> -- >> Filipe David Manana, >> [email protected], [email protected] >> >> "Reasonable men adapt themselves to the world. >> Unreasonable men adapt the world to themselves. >> That's why all progress depends on unreasonable men." >> >
