From 087e6e890ce151a703479b301b202a0e6c0ec194 Mon Sep 17 00:00:00 2001 From: Drew Paroski Date: Sat, 10 Aug 2013 02:20:14 -0700 Subject: [PATCH] Remove more deprecated collections APIs Differential Revision: D923014 --- hphp/runtime/ext/ext_collections.cpp | 122 ----------------------- hphp/runtime/ext/ext_collections.h | 7 -- hphp/system/idl/collections.idl.json | 105 ------------------- hphp/test/slow/collection_classes/804.php | 2 +- hphp/test/slow/collection_classes/804.php.expect | 1 - 5 files changed, 1 insertion(+), 236 deletions(-) diff --git a/hphp/runtime/ext/ext_collections.cpp b/hphp/runtime/ext/ext_collections.cpp index 08f8e08f728..0dca7a28b74 100644 --- a/hphp/runtime/ext/ext_collections.cpp +++ b/hphp/runtime/ext/ext_collections.cpp @@ -1269,10 +1269,6 @@ Object c_Map::t_removekey(CVarRef key) { return t_remove(key); } -Object c_Map::t_discard(CVarRef key) { - return t_remove(key); -} - Array c_Map::t_toarray() { return toArrayImpl(); } @@ -1329,61 +1325,6 @@ Array c_Map::t_tovaluesarray() { return ai.toArray(); } -Object c_Map::t_updatefromarray(CVarRef arr) { - if (!arr.isArray()) { - Object e(SystemLib::AllocInvalidArgumentExceptionObject( - "Expected arr to be an array")); - throw e; - } - ArrayData* ad = arr.getArrayData(); - for (ssize_t pos = ad->iter_begin(); pos != ArrayData::invalid_index; - pos = ad->iter_advance(pos)) { - Variant k = ad->getKey(pos); - TypedValue* tv = cvarToCell(&ad->getValueRef(pos)); - if (k.isInteger()) { - update(k.toInt64(), tv); - } else { - assert(k.isString()); - update(k.getStringData(), tv); - } - } - return this; -} - -Object c_Map::t_updatefromiterable(CVarRef it) { - if (!it.isObject()) { - Object e(SystemLib::AllocInvalidArgumentExceptionObject( - "Parameter it must be an instance of Iterable")); - throw e; - } - ObjectData* obj = it.getObjectData(); - if (obj->getCollectionType() == Collection::MapType) { - auto mp = static_cast(obj); - for (uint i = 0; i <= mp->m_nLastSlot; ++i) { - c_Map::Bucket& p = mp->m_data[i]; - if (!p.validValue()) continue; - if (p.hasIntKey()) { - update((int64_t)p.ikey, &p.data); - } else { - update(p.skey, &p.data); - } - } - return this; - } - for (ArrayIter iter = obj->begin(); iter; ++iter) { - Variant k = iter.first(); - Variant v = iter.second(); - TypedValue* tv = tvToCell(v.asTypedValue()); - if (k.isInteger()) { - update(k.toInt64(), tv); - } else { - assert(k.isString()); - update(k.getStringData(), tv); - } - } - return this; -} - Object c_Map::t_differencebykey(CVarRef it) { if (!it.isObject()) { Object e(SystemLib::AllocInvalidArgumentExceptionObject( @@ -2426,10 +2367,6 @@ Object c_StableMap::t_removekey(CVarRef key) { return t_remove(key); } -Object c_StableMap::t_discard(CVarRef key) { - return t_remove(key); -} - Array c_StableMap::t_toarray() { return toArrayImpl(); } @@ -2481,61 +2418,6 @@ Array c_StableMap::t_tovaluesarray() { return ai.toArray(); } -Object c_StableMap::t_updatefromarray(CVarRef arr) { - if (!arr.isArray()) { - Object e(SystemLib::AllocInvalidArgumentExceptionObject( - "Parameter arr must be an array")); - throw e; - } - ArrayData* ad = arr.getArrayData(); - for (ssize_t pos = ad->iter_begin(); pos != ArrayData::invalid_index; - pos = ad->iter_advance(pos)) { - Variant k = ad->getKey(pos); - TypedValue* tv = cvarToCell(&ad->getValueRef(pos)); - if (k.isInteger()) { - update(k.toInt64(), tv); - } else { - assert(k.isString()); - update(k.getStringData(), tv); - } - } - return this; -} - -Object c_StableMap::t_updatefromiterable(CVarRef it) { - if (!it.isObject()) { - Object e(SystemLib::AllocInvalidArgumentExceptionObject( - "Parameter it must be an instance of Iterable")); - throw e; - } - ObjectData* obj = it.getObjectData(); - if (obj->getCollectionType() == Collection::StableMapType) { - auto smp = static_cast(obj); - c_StableMap::Bucket* p = smp->m_pListHead; - while (p) { - if (p->hasIntKey()) { - update((int64_t)p->ikey, &p->data); - } else { - update(p->skey, &p->data); - } - p = p->pListNext; - } - return this; - } - for (ArrayIter iter = obj->begin(); iter; ++iter) { - Variant k = iter.first(); - Variant v = iter.second(); - TypedValue* tv = cvarToCell(&v); - if (k.isInteger()) { - update(k.toInt64(), tv); - } else { - assert(k.isString()); - update(k.getStringData(), tv); - } - } - return this; -} - Object c_StableMap::t_differencebykey(CVarRef it) { if (!it.isObject()) { Object e(SystemLib::AllocInvalidArgumentExceptionObject( @@ -3656,10 +3538,6 @@ Object c_Set::ti_fromarray(CVarRef arr) { return ret; } -Object c_Set::t_discard(CVarRef key) { - return t_remove(key); -} - Object c_Set::t_difference(CVarRef iterable) { if (iterable.isNull()) return this; size_t sz; diff --git a/hphp/runtime/ext/ext_collections.h b/hphp/runtime/ext/ext_collections.h index a39c2c1bed3..7934f8b1b11 100644 --- a/hphp/runtime/ext/ext_collections.h +++ b/hphp/runtime/ext/ext_collections.h @@ -243,14 +243,11 @@ class c_Map : public ExtObjectDataFlags$method(1); diff --git a/hphp/test/slow/collection_classes/804.php.expect b/hphp/test/slow/collection_classes/804.php.expect index 87d54e6a1b9..dc73cb9e1ad 100644 --- a/hphp/test/slow/collection_classes/804.php.expect +++ b/hphp/test/slow/collection_classes/804.php.expect @@ -1,3 +1,2 @@ ABCD CD -CD -- 2.11.4.GIT