Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of TSRMLS in kernel/string wherever possible #833

Merged
merged 1 commit into from Jul 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Got rid of TSRMLS in kernel/string wherever possible
  • Loading branch information
sjinks committed Jul 12, 2013
commit 02eaf7563e56dbbdbea39d58dd9c38bf8d259220
7 changes: 3 additions & 4 deletions ext/cache/backend/xcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,20 +385,19 @@ PHP_METHOD(Phalcon_Cache_Backend_Xcache, queryKeys){
PHALCON_GET_HKEY(key, ah0, hp0);
PHALCON_GET_HVALUE(ttl);

if (!phalcon_memnstr(key, prefix TSRMLS_CC)) {
if (!phalcon_memnstr(key, prefix)) {
zend_hash_move_forward_ex(ah0, &hp0);
continue;
}

PHALCON_INIT_NVAR(real_key);
phalcon_substr(real_key, key, 5, 0 TSRMLS_CC);
phalcon_substr(real_key, key, 5, 0);
phalcon_array_append(&prefixed_keys, real_key, PH_SEPARATE);

RETURN_CTOR(prefixed_keys);

zend_hash_move_forward_ex(ah0, &hp0);
}

RETURN_CTOR(prefixed_keys);
}

RETURN_MM_EMPTY_ARRAY();
Expand Down
4 changes: 2 additions & 2 deletions ext/config/adapter/ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct){
PHALCON_GET_HKEY(key, ah1, hp1);
PHALCON_GET_HVALUE(value);

if (phalcon_memnstr_str(key, SL(".") TSRMLS_CC)) {
if (phalcon_memnstr_str(key, SL("."))) {
PHALCON_INIT_NVAR(directive_parts);
phalcon_fast_explode_str(directive_parts, SL("."), key TSRMLS_CC);
phalcon_fast_explode_str(directive_parts, SL("."), key);

PHALCON_OBS_NVAR(left_part);
phalcon_array_fetch_long(&left_part, directive_parts, 0, PH_NOISY);
Expand Down
22 changes: 11 additions & 11 deletions ext/db/adapter/pdo/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){
/**
* Enum are treated as char
*/
if (phalcon_memnstr_str(column_type, SL("enum") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("enum"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
break;
}

/**
* Smallint/Bigint/Integers/Int are int
*/
if (phalcon_memnstr_str(column_type, SL("int") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("int"))) {
phalcon_array_update_string_long(&definition, SL("type"), 0, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("isNumeric"), &ztrue, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 1, PH_SEPARATE);
Expand All @@ -220,23 +220,23 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){
/**
* Varchar are varchars
*/
if (phalcon_memnstr_str(column_type, SL("varchar") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("varchar"))) {
phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE);
break;
}

/**
* Special type for datetime
*/
if (phalcon_memnstr_str(column_type, SL("datetime") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("datetime"))) {
phalcon_array_update_string_long(&definition, SL("type"), 4, PH_SEPARATE);
break;
}

/**
* Decimals are floats
*/
if (phalcon_memnstr_str(column_type, SL("decimal") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("decimal"))) {
phalcon_array_update_string_long(&definition, SL("type"), 3, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("isNumeric"), &ztrue, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
Expand All @@ -246,31 +246,31 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){
/**
* Chars are chars
*/
if (phalcon_memnstr_str(column_type, SL("char") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("char"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
break;
}

/**
* Date/Datetime are varchars
*/
if (phalcon_memnstr_str(column_type, SL("date") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("date"))) {
phalcon_array_update_string_long(&definition, SL("type"), 1, PH_SEPARATE);
break;
}

/**
* Text are varchars
*/
if (phalcon_memnstr_str(column_type, SL("text") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("text"))) {
phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE);
break;
}

/**
* Float/Smallfloats/Decimals are float
*/
if (phalcon_memnstr_str(column_type, SL("float") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("float"))) {
phalcon_array_update_string_long(&definition, SL("type"), 7, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("isNumeric"), &ztrue, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
Expand All @@ -287,7 +287,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){
/**
* If the column type has a parentheses we try to get the column size from it
*/
if (phalcon_memnstr_str(column_type, SL("(") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("("))) {

PHALCON_INIT_NVAR(matches);

Expand Down Expand Up @@ -315,7 +315,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){
/**
* Check if the column is unsigned, only MySQL support this
*/
if (phalcon_memnstr_str(column_type, SL("unsigned") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("unsigned"))) {
phalcon_array_update_string(&definition, SL("unsigned"), &ztrue, PH_COPY | PH_SEPARATE);
}

Expand Down
20 changes: 10 additions & 10 deletions ext/db/adapter/pdo/oracle.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,47 +212,47 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Oracle, describeColumns){
/**
* Check the column type to get the correct Phalcon type
*/
if (phalcon_memnstr_str(column_type, SL("NUMBER") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("NUMBER"))) {
phalcon_array_update_string_long(&definition, SL("type"), 3, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &column_precision, PH_COPY | PH_SEPARATE);
phalcon_array_update_string(&definition, SL("scale"), &column_scale, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("INTEGER") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("INTEGER"))) {
phalcon_array_update_string_long(&definition, SL("type"), 0, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &column_precision, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 1, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("VARCHAR2") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("VARCHAR2"))) {
phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("FLOAT") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("FLOAT"))) {
phalcon_array_update_string_long(&definition, SL("type"), 7, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE);
phalcon_array_update_string(&definition, SL("scale"), &column_scale, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("TIMESTAMP") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("TIMESTAMP"))) {
phalcon_array_update_string_long(&definition, SL("type"), 1, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("RAW") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("RAW"))) {
phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("BLOB") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("BLOB"))) {
phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("CLOB") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("CLOB"))) {
phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("VARCHAR2") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("VARCHAR2"))) {
phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("CHAR") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("CHAR"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE);
} else {
Expand Down
22 changes: 11 additions & 11 deletions ext/db/adapter/pdo/postgresql.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,50 +195,50 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns){
/**
* Check the column type to get the correct Phalcon type
*/
if (phalcon_memnstr_str(column_type, SL("int") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("int"))) {
phalcon_array_update_string_long(&definition, SL("type"), 0, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &numeric_size, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 1, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("varying") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("varying"))) {
phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &char_size, PH_COPY | PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("date") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("date"))) {
phalcon_array_update_string_long(&definition, SL("type"), 1, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("size"), 0, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("numeric") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("numeric"))) {
phalcon_array_update_string_long(&definition, SL("type"), 3, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &numeric_size, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("char") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("char"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &char_size, PH_COPY | PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("timestamp") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("timestamp"))) {
phalcon_array_update_string_long(&definition, SL("type"), 4, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("size"), 0, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("text") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("text"))) {
phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &char_size, PH_COPY | PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("float") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("float"))) {
phalcon_array_update_string_long(&definition, SL("type"), 7, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string(&definition, SL("size"), &numeric_size, PH_COPY | PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("bool") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("bool"))) {
phalcon_array_update_string_long(&definition, SL("type"), 8, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("size"), 0, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 5, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("uuid") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("uuid"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("size"), 36, PH_SEPARATE);
} else {
Expand All @@ -255,7 +255,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, describeColumns){
}
}

if (phalcon_memnstr_str(column_type, SL("unsigned") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("unsigned"))) {
phalcon_array_update_string_bool(&definition, SL("unsigned"), 1, PH_SEPARATE);
}

Expand Down
22 changes: 11 additions & 11 deletions ext/db/adapter/pdo/sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns){
phalcon_array_fetch_long(&column_type, field, 2, PH_NOISY);

PHALCON_INIT_NVAR(pos);
phalcon_fast_stripos_str(pos, column_type, SL("int") TSRMLS_CC);
phalcon_fast_stripos_str(pos, column_type, SL("int"));
if (PHALCON_IS_NOT_FALSE(pos)) {
phalcon_array_update_string_long(&definition, SL("type"), 0, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
Expand All @@ -194,32 +194,32 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns){
phalcon_array_update_string_bool(&definition, SL("autoIncrement"), 1, PH_SEPARATE);
}
} else {
if (phalcon_memnstr_str(column_type, SL("varchar") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("varchar"))) {
phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("date") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("date"))) {
phalcon_array_update_string_long(&definition, SL("type"), 1, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("decimal") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("decimal"))) {
phalcon_array_update_string_long(&definition, SL("type"), 3, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("char") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("char"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("datetime") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("datetime"))) {
phalcon_array_update_string_long(&definition, SL("type"), 4, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("text") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("text"))) {
phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("float") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("float"))) {
phalcon_array_update_string_long(&definition, SL("type"), 7, PH_SEPARATE);
phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE);
phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE);
} else {
if (phalcon_memnstr_str(column_type, SL("enum") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("enum"))) {
phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE);
} else {
phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE);
Expand All @@ -233,7 +233,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns){
}
}

if (phalcon_memnstr_str(column_type, SL("(") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("("))) {

PHALCON_INIT_NVAR(matches);

Expand All @@ -258,7 +258,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns){
}
}

if (phalcon_memnstr_str(column_type, SL("unsigned") TSRMLS_CC)) {
if (phalcon_memnstr_str(column_type, SL("unsigned"))) {
phalcon_array_update_string_bool(&definition, SL("unsigned"), 1, PH_SEPARATE);
}

Expand Down
2 changes: 1 addition & 1 deletion ext/db/dialect/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Mysql, _getTableOptions){
phalcon_array_fetch_string(&table_collation, options, SL("TABLE_COLLATION"), PH_NOISY);
if (zend_is_true(table_collation)) {
PHALCON_INIT_VAR(collation_parts);
phalcon_fast_explode_str(collation_parts, SL("_"), table_collation TSRMLS_CC);
phalcon_fast_explode_str(collation_parts, SL("_"), table_collation);

PHALCON_OBS_VAR(first_part);
phalcon_array_fetch_long(&first_part, collation_parts, 0, PH_NOISY);
Expand Down
Loading