Consolidate more ArrayData methods: getKey, getValue, and nvGetValueRef

getKey wraps nvGetKey
getValue and nvGetValueRef wrap getValueRef
Esse commit está contido em:
Edwin Smith
2013-07-03 14:51:28 -07:00
commit de Sara Golemon
commit 29b1fb3cf0
11 arquivos alterados com 75 adições e 138 exclusões
-34
Ver Arquivo
@@ -281,15 +281,6 @@ void ArrayData::freeFullPos(FullPos &fp) {
assert(false);
}
bool ArrayData::validFullPos(const FullPos& fp) const {
assert(fp.getContainer() == (ArrayData*)this);
return false;
}
bool ArrayData::advanceFullPos(FullPos& fp) {
return false;
}
void ArrayData::freeStrongIterators() {
for (FullPosRange r(strongIterators()); !r.empty(); r.popFront()) {
r.front()->setContainer(nullptr);
@@ -477,31 +468,6 @@ CVarRef ArrayData::get(CVarRef k, bool error) const {
: get(getStringKey(cell), error);
}
void ArrayData::nvGetKey(TypedValue* out, ssize_t pos) {
Variant k = getKey(pos);
TypedValue* tv = k.asTypedValue();
// copy w/out clobbering out->_count.
out->m_type = tv->m_type;
out->m_data.num = tv->m_data.num;
if (tv->m_type != KindOfInt64) out->m_data.pstr->incRefCount();
}
TypedValue* ArrayData::nvGetValueRef(ssize_t pos) {
return const_cast<TypedValue*>(getValueRef(pos).asTypedValue());
}
TypedValue* ArrayData::nvGetCell(int64_t k) const {
TypedValue* tv = (TypedValue*)&get(k, false);
return LIKELY(tv != (TypedValue*)&null_variant) ? tvToCell(tv) :
nvGetNotFound(k);
}
TypedValue* ArrayData::nvGetCell(const StringData* key) const {
TypedValue* tv = (TypedValue*)&get(key, false);
return LIKELY(tv != (TypedValue*)&null_variant) ? tvToCell(tv) :
nvGetNotFound(key);
}
CVarRef ArrayData::getNotFound(int64_t k) {
raise_notice("Undefined index: %" PRId64, k);
return null_variant;