ArrayData *ZendArray::remove(CVarRef k, bool copy) { TypedValueAccessor tva = k.getTypedAccessor(); if (isIntKey(tva)) { if (UNLIKELY(copy)) { ZendArray *a = copyImpl(); a->prepareBucketHeadsForWrite(); a->erase(a->findForErase(getIntKey(tva))); return a; } prepareBucketHeadsForWrite(); erase(findForErase(getIntKey(tva))); return NULL; } else { ASSERT(k.isString()); StringData *key = getStringKey(tva); int64 prehash = key->hash(); if (UNLIKELY(copy)) { ZendArray *a = copyImpl(); a->prepareBucketHeadsForWrite(); a->erase(a->findForErase(key->data(), key->size(), prehash)); return a; } prepareBucketHeadsForWrite(); erase(findForErase(key->data(), key->size(), prehash)); return NULL; } }
ArrayData *ZendArray::remove(int64 k, bool copy) { if (UNLIKELY(copy)) { ZendArray *a = copyImpl(); a->prepareBucketHeadsForWrite(); a->erase(a->findForErase(k)); return a; } prepareBucketHeadsForWrite(); erase(findForErase(k)); return NULL; }
ArrayData *ZendArray::remove(CStrRef k, bool copy) { int64 prehash = k->hash(); if (UNLIKELY(copy)) { ZendArray *a = copyImpl(); a->prepareBucketHeadsForWrite(); a->erase(a->findForErase(k.data(), k.size(), prehash)); return a; } prepareBucketHeadsForWrite(); erase(findForErase(k.data(), k.size(), prehash)); return NULL; }