summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-04-17 12:35:35 +0000
committerDries Buytaert <dries@buytaert.net>2010-04-17 12:35:35 +0000
commit2aad3ce052623742a27825960df803200c4fa5d7 (patch)
treed7f9f1926372e5ce033911ea4d36bbef2e361aaf /includes
parent7864b0066b4ad3fc17ce1526b1e4ecae52b2f9c8 (diff)
downloadbrdo-2aad3ce052623742a27825960df803200c4fa5d7.tar.gz
brdo-2aad3ce052623742a27825960df803200c4fa5d7.tar.bz2
- Patch #768518 by catch: element_info() should use drupal_static_fast() pattern.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc7
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index b3497d0d9..312246d77 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5291,7 +5291,12 @@ function element_sort($a, $b) {
* Retrieve the default properties for the defined element type.
*/
function element_info($type) {
- $cache = &drupal_static(__FUNCTION__);
+ // Use the advanced drupal_static() pattern, since this is called very often.
+ static $drupal_static_fast;
+ if (!isset($drupal_static_fast)) {
+ $drupal_static_fast['cache'] = &drupal_static(__FUNCTION__);
+ }
+ $cache = &$drupal_static_fast['cache'];
if (!isset($cache)) {
$cache = module_invoke_all('element_info');