Skip to content

Commit

Permalink
Avoid memory allocation for array literal. See #984.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Feb 21, 2015
1 parent 3894447 commit 0713a65
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions source/vibe/http/router.d
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,12 @@ interface HTTPRouter : HTTPServerRequestHandler {
final HTTPRouter any(string url_match, HTTPServerRequestDelegate cb)
{
import std.traits;
HTTPRouter route;
static HTTPMethod[] all_methods = [EnumMembers!HTTPMethod];

foreach(immutable method; [EnumMembers!HTTPMethod])
if(route is null)
route = match(method, url_match, cb);
else
route = route.match(method, url_match, cb);
foreach(immutable method; all_methods)
match(method, url_match, cb);

return route;
return this;
}
}

Expand Down

0 comments on commit 0713a65

Please sign in to comment.