summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-20 06:12:45 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-20 06:12:45 +0000
commitb14349889e9e51fb44934694030e95306918e3bd (patch)
tree68836bca71b2ebb1c5d17b0b20dee9b0aba113ab /modules/user/user.module
parent56e35716bca7569ec796ca5829f7921319abdc51 (diff)
downloadbrdo-b14349889e9e51fb44934694030e95306918e3bd.tar.gz
brdo-b14349889e9e51fb44934694030e95306918e3bd.tar.bz2
#619666 by effulgentsia, casey, and catch: Changed Introduce new pattern for drupal_static() in performance-critical functions.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 2772b5ffb..a244ea887 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -679,7 +679,10 @@ function user_role_permissions($roles = array()) {
*/
function user_access($string, $account = NULL) {
global $user;
- $perm = &drupal_static(__FUNCTION__, array());
+ // Use the advanced drupal_static() pattern, since this is called very often.
+ static $drupal_static = array();
+ isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
+ $perm = &$drupal_static[__FUNCTION__];
if (!isset($account)) {
$account = $user;