mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-10 15:51:29 +00:00
[Code] Update perlbind to 1.1.0 (#4529)
- Adds a perl::ref alias for perl::reference - Optimizes array return pushes by accessing SV* values directly instead of using operator[] scalar_proxy - Allows functions with a perl::hash parameter to accept hashes with any scalar key type instead of requiring explicit string keys e.g., foo(123 => 1) will now work on functions accepting a perl::hash
This commit is contained in:
parent
95249889a6
commit
25ef3d2cdb
@ -251,4 +251,6 @@ private:
|
||||
scalar m_value;
|
||||
};
|
||||
|
||||
using ref = reference;
|
||||
|
||||
} // namespace perlbind
|
||||
|
||||
@ -28,8 +28,8 @@ struct pusher
|
||||
++m_pushed;
|
||||
}
|
||||
void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; }
|
||||
void push(scalar value) { mPUSHs(value.release()); ++m_pushed; };
|
||||
void push(reference value) { mPUSHs(value.release()); ++m_pushed; };
|
||||
void push(scalar value) { mPUSHs(value.release()); ++m_pushed; }
|
||||
void push(reference value) { mPUSHs(value.release()); ++m_pushed; }
|
||||
|
||||
void push(array value)
|
||||
{
|
||||
@ -38,7 +38,8 @@ struct pusher
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
// mortalizes one reference to array element to avoid copying
|
||||
PUSHs(sv_2mortal(SvREFCNT_inc(value[i].sv())));
|
||||
SV** sv = av_fetch(static_cast<AV*>(value), i, true);
|
||||
mPUSHs(SvREFCNT_inc(*sv));
|
||||
}
|
||||
m_pushed += count;
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ struct read_as<hash>
|
||||
static bool check(PerlInterpreter* my_perl, int i, int ax, int items)
|
||||
{
|
||||
int remaining = items - i;
|
||||
return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) == SVt_PV;
|
||||
return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) < SVt_PVAV;
|
||||
}
|
||||
|
||||
static hash get(PerlInterpreter* my_perl, int i, int ax, int items)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
constexpr int perlbind_version_major = 1;
|
||||
constexpr int perlbind_version_minor = 0;
|
||||
constexpr int perlbind_version_minor = 1;
|
||||
constexpr int perlbind_version_patch = 0;
|
||||
|
||||
constexpr int perlbind_version()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user