diff options
author | Felipe Pena <felipe@php.net> | 2009-03-27 19:50:56 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2009-03-27 19:50:56 +0000 |
commit | 7c860bb018c3d02c3f30c424d8f05fa633fd5185 (patch) | |
tree | 65f1ad7a34e65b3abedec82a9e46850e82cddf8b /sapi/cli/php_cli_readline.c | |
parent | 04c90a0f510b0524ea1b4151841d41208520a48e (diff) | |
download | php-git-7c860bb018c3d02c3f30c424d8f05fa633fd5185.tar.gz |
- Removed leftover UG(unicode) checks
Diffstat (limited to 'sapi/cli/php_cli_readline.c')
-rw-r--r-- | sapi/cli/php_cli_readline.c | 105 |
1 files changed, 43 insertions, 62 deletions
diff --git a/sapi/cli/php_cli_readline.c b/sapi/cli/php_cli_readline.c index d6e8026357..876775f123 100644 --- a/sapi/cli/php_cli_readline.c +++ b/sapi/cli/php_cli_readline.c @@ -286,7 +286,7 @@ static char *cli_completion_generator_ht(const char *text, int textlen, int *sta } while(zend_hash_has_more_elements(ht) == SUCCESS) { zend_hash_get_current_key(ht, &name, &number, 0); - if (!textlen || (UG(unicode) ? !zend_cmp_unicode_and_string(name.u, (char *)text, textlen) : !strncmp(name.s, text, textlen))) { + if (!textlen || !zend_cmp_unicode_and_string(name.u, (char *)text, textlen)) { if (pData) { zend_hash_get_current_data(ht, pData); } @@ -307,25 +307,18 @@ static char *cli_completion_generator_var(const char *text, int textlen, int *st tmp = retval = cli_completion_generator_ht(text + 1, textlen - 1, state, EG(active_symbol_table), NULL TSRMLS_CC); if (retval) { - if (UG(unicode)) { - int32_t tmp_len, len; - UErrorCode status = U_ZERO_ERROR; - - len = u_strlen((UChar *)retval); - zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, - (UChar *)retval, len, &status); - - retval = malloc(tmp_len + 2); - retval[0] = '$'; - strcpy(&retval[1], tmp); - rl_completion_append_character = '\0'; - efree(tmp); - } else { - retval = malloc(strlen(tmp) + 2); - retval[0] = '$'; - strcpy(&retval[1], tmp); - rl_completion_append_character = '\0'; - } + int32_t tmp_len, len; + UErrorCode status = U_ZERO_ERROR; + + len = u_strlen((UChar *)retval); + zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, + (UChar *)retval, len, &status); + + retval = malloc(tmp_len + 2); + retval[0] = '$'; + strcpy(&retval[1], tmp); + rl_completion_append_character = '\0'; + efree(tmp); } return retval; } /* }}} */ @@ -337,22 +330,18 @@ static char *cli_completion_generator_func(const char *text, int textlen, int *s retval = cli_completion_generator_ht(text, textlen, state, ht, (void**)&func TSRMLS_CC); if (retval) { - rl_completion_append_character = '('; - - if (UG(unicode)) { - char *tmp; - int32_t tmp_len, len; - UErrorCode status = U_ZERO_ERROR; - - len = u_strlen((UChar *)func->common.function_name.u); - zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, - (UChar *)func->common.function_name.u, len, &status); - - retval = strdup(tmp); - efree(tmp); - } else { - retval = strdup(func->common.function_name.s); - } + char *tmp; + int32_t tmp_len, len; + UErrorCode status = U_ZERO_ERROR; + + rl_completion_append_character = '('; + + len = u_strlen((UChar *)func->common.function_name.u); + zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, + (UChar *)func->common.function_name.u, len, &status); + + retval = strdup(tmp); + efree(tmp); } return retval; @@ -363,22 +352,18 @@ static char *cli_completion_generator_class(const char *text, int textlen, int * zend_class_entry **pce; char *retval = cli_completion_generator_ht(text, textlen, state, EG(class_table), (void**)&pce TSRMLS_CC); if (retval) { + char *tmp; + int32_t tmp_len, len; + UErrorCode status = U_ZERO_ERROR; + rl_completion_append_character = '\0'; - if (UG(unicode)) { - char *tmp; - int32_t tmp_len, len; - UErrorCode status = U_ZERO_ERROR; - - len = u_strlen((UChar *)(*pce)->name.u); - zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, - (UChar *)(*pce)->name.u, len, &status); + len = u_strlen((UChar *)(*pce)->name.u); + zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, + (UChar *)(*pce)->name.u, len, &status); - retval = strdup(tmp); - efree(tmp); - } else { - retval = strdup((*pce)->name.s); - } + retval = strdup(tmp); + efree(tmp); } return retval; @@ -389,22 +374,18 @@ static char *cli_completion_generator_define(const char *text, int textlen, int zend_class_entry **pce; char *retval = cli_completion_generator_ht(text, textlen, state, ht, (void**)&pce TSRMLS_CC); if (retval) { + char *tmp; + int32_t tmp_len, len; + UErrorCode status = U_ZERO_ERROR; + rl_completion_append_character = '\0'; - if (UG(unicode)) { - char *tmp; - int32_t tmp_len, len; - UErrorCode status = U_ZERO_ERROR; - - len = u_strlen((UChar *)retval); - zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, - (UChar *)retval, len, &status); + len = u_strlen((UChar *)retval); + zend_unicode_to_string_ex(ZEND_U_CONVERTER(UG(output_encoding_conv)), &tmp, &tmp_len, + (UChar *)retval, len, &status); - retval = strdup(tmp); - efree(tmp); - } else { - retval = strdup(retval); - } + retval = strdup(tmp); + efree(tmp); } return retval; |