Skip to content

Commit

Permalink
chore: deps upgrade (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptondereau committed May 16, 2023
1 parent 63a7684 commit eaab5f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ categories = ["api-bindings"]
exclude = ["/.github", "/.crates", "/guide"]

[dependencies]
bitflags = "1.2.1"
parking_lot = "0.12.1"
bitflags = "2"
parking_lot = "0.12"
cfg-if = "1.0"
once_cell = "1.8.0"
once_cell = "1.17"
anyhow = { version = "1", optional = true }
ext-php-rs-derive = { version = "=0.10.0", path = "./crates/macros" }

Expand Down
21 changes: 14 additions & 7 deletions src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::error::{Error, Result};

bitflags! {
/// Flags used for setting the type of Zval.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ZvalTypeFlags: u32 {
const Undef = IS_UNDEF;
const Null = IS_NULL;
Expand All @@ -45,13 +46,13 @@ bitflags! {
const Void = IS_VOID;
const Ptr = IS_PTR;

const InternedStringEx = Self::String.bits;
const StringEx = Self::String.bits | Self::RefCounted.bits;
const ArrayEx = Self::Array.bits | Self::RefCounted.bits | Self::Collectable.bits;
const ObjectEx = Self::Object.bits | Self::RefCounted.bits | Self::Collectable.bits;
const ResourceEx = Self::Resource.bits | Self::RefCounted.bits;
const ReferenceEx = Self::Reference.bits | Self::RefCounted.bits;
const ConstantAstEx = Self::ConstantExpression.bits | Self::RefCounted.bits;
const InternedStringEx = Self::String.bits();
const StringEx = Self::String.bits() | Self::RefCounted.bits();
const ArrayEx = Self::Array.bits() | Self::RefCounted.bits() | Self::Collectable.bits();
const ObjectEx = Self::Object.bits() | Self::RefCounted.bits() | Self::Collectable.bits();
const ResourceEx = Self::Resource.bits() | Self::RefCounted.bits();
const ReferenceEx = Self::Reference.bits() | Self::RefCounted.bits();
const ConstantAstEx = Self::ConstantExpression.bits() | Self::RefCounted.bits();

const RefCounted = (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
const Collectable = (IS_TYPE_COLLECTABLE << Z_TYPE_FLAGS_SHIFT);
Expand All @@ -60,6 +61,7 @@ bitflags! {

bitflags! {
/// Flags for building classes.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ClassFlags: u32 {
const Final = ZEND_ACC_FINAL;
const Abstract = ZEND_ACC_ABSTRACT;
Expand Down Expand Up @@ -91,6 +93,7 @@ bitflags! {

bitflags! {
/// Flags for building methods.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct MethodFlags: u32 {
const Public = ZEND_ACC_PUBLIC;
const Protected = ZEND_ACC_PROTECTED;
Expand Down Expand Up @@ -126,6 +129,7 @@ bitflags! {

bitflags! {
/// Flags for building properties.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct PropertyFlags: u32 {
const Public = ZEND_ACC_PUBLIC;
const Protected = ZEND_ACC_PROTECTED;
Expand All @@ -138,6 +142,7 @@ bitflags! {

bitflags! {
/// Flags for building constants.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ConstantFlags: u32 {
const Public = ZEND_ACC_PUBLIC;
const Protected = ZEND_ACC_PROTECTED;
Expand All @@ -148,6 +153,7 @@ bitflags! {

bitflags! {
/// Flags for building module global constants.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct GlobalConstantFlags: u32 {
const CaseSensitive = CONST_CS;
const Persistent = CONST_PERSISTENT;
Expand All @@ -158,6 +164,7 @@ bitflags! {

bitflags! {
/// Represents the result of a function.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ZendResult: i32 {
const Success = 0;
const Failure = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/types/zval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ impl Zval {
// SAFETY: If the value if refcounted (`self.u1.type_info & Z_TYPE_FLAGS_MASK`)
// then it is valid to dereference `self.value.counted`.
unsafe {
let flags = ZvalTypeFlags::from_bits_unchecked(self.u1.type_info);
let flags = ZvalTypeFlags::from_bits_retain(self.u1.type_info);
if flags.contains(ZvalTypeFlags::RefCounted) {
(*self.value.counted).gc.refcount += 1;
}
Expand Down

0 comments on commit eaab5f0

Please sign in to comment.