summaryrefslogtreecommitdiff
path: root/ext/intl/msgformat/msgformat_helpers.cpp
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-06-01 11:58:57 +0300
committerDmitry Stogov <dmitry@zend.com>2018-06-01 11:58:57 +0300
commit0b90cf85a6ace22abd0f9f86d5015a5b6db92387 (patch)
treee01be0712ad1d7dbcd61c81ce03b9544a69e4972 /ext/intl/msgformat/msgformat_helpers.cpp
parent9e0f131d2b0e8bf98859c12104a7b0cd8951c135 (diff)
downloadphp-git-0b90cf85a6ace22abd0f9f86d5015a5b6db92387.tar.gz
Removed "dead" code (zend_hash_update() never fails)
Diffstat (limited to 'ext/intl/msgformat/msgformat_helpers.cpp')
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 65a00289b5..a3005ded3b 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -122,11 +122,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
for (int i = 0; i < parts_count; i++) {
const Formattable::Type t = types[i];
- if (zend_hash_index_update_mem(ret, (zend_ulong)i, (void*)&t, sizeof(t)) == NULL) {
- intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
- "Write to argument types hash table failed", 0);
- break;
- }
+ zend_hash_index_update_mem(ret, (zend_ulong)i, (void*)&t, sizeof(t));
}
if (U_FAILURE(err.code)) {
@@ -196,12 +192,8 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
if ((storedType = (Formattable::Type*)zend_hash_str_find_ptr(ret, (char*)argName.getBuffer(), argName.length())) == NULL) {
/* not found already; create new entry in HT */
Formattable::Type bogusType = Formattable::kObject;
- if ((storedType = (Formattable::Type*)zend_hash_str_update_mem(ret, (char*)argName.getBuffer(), argName.length(),
- (void*)&bogusType, sizeof(bogusType))) == NULL) {
- intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
- "Write to argument types hash table failed", 0);
- continue;
- }
+ storedType = (Formattable::Type*)zend_hash_str_update_mem(ret, (char*)argName.getBuffer(), argName.length(),
+ (void*)&bogusType, sizeof(bogusType));
}
} else if (name_part.getType() == UMSGPAT_PART_TYPE_ARG_NUMBER) {
int32_t argNumber = name_part.getValue();
@@ -213,11 +205,7 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (zend_ulong)argNumber)) == NULL) {
/* not found already; create new entry in HT */
Formattable::Type bogusType = Formattable::kObject;
- if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (zend_ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
- intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
- "Write to argument types hash table failed", 0);
- continue;
- }
+ storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (zend_ulong)argNumber, (void*)&bogusType, sizeof(bogusType));
}
} else {
intl_errors_set(&err, U_INVALID_FORMAT_ERROR, "Invalid part type encountered", 0);