Skip to content

Commit

Permalink
Issue #16038: improve performance
Browse files Browse the repository at this point in the history
Use strpos+substr instead of preg_match.
  • Loading branch information
dregad committed Jun 10, 2013
1 parent c2dd477 commit 38bc024
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/database_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ function db_time_queries() {
* @return string containing full database table name (with prefix and suffix)
*/
function db_get_table( $p_name ) {
if( 1 == preg_match( '/^mantis_(.*)_table$/', $p_name, $t_table ) ) {
$t_table = $t_table[1];
if( strpos( $p_name, 'mantis_') === 0 ) {
$t_table = substr( $p_name, 7, strpos( $p_name, '_table' ) - 7 );
error_parameters(
"db_get_table( '$p_name' )",
"db_get_table( '$t_table' )"
Expand Down

0 comments on commit 38bc024

Please sign in to comment.