资源简介
perl-5.24.0.tar.gz
代码片段和文件信息
/* av.c
*
* Copyright (C) 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
* 2001 2002 2003 2004 2005 2006 2007 2008 by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License as specified in the README file.
*
*/
/*
* ‘...for the Entwives desired order and plenty and peace (by which they
* meant that things should remain where they had set them).‘ --Treebeard
*
* [p.476 of _The Lord of the Rings_ III/iv: “Treebeard“]
*/
/*
=head1 Array Manipulation Functions
*/
#include “EXTERN.h“
#define PERL_IN_AV_C
#include “perl.h“
void
Perl_av_reify(pTHX_ AV *av)
{
SSize_t key;
PERL_ARGS_ASSERT_AV_REIFY;
assert(SvTYPE(av) == SVt_PVAV);
if (AvREAL(av))
return;
#ifdef DEBUGGING
if (SvTIED_mg((const SV *)av PERL_MAGIC_tied))
Perl_ck_warner_d(aTHX_ packWARN(WARN_DEBUGGING) “av_reify called on tied array“);
#endif
key = AvMAX(av) + 1;
while (key > AvFILLp(av) + 1)
AvARRAY(av)[--key] = NULL;
while (key) {
SV * const sv = AvARRAY(av)[--key];
if (sv != &PL_sv_undef)
SvREFCNT_inc_simple_void(sv);
}
key = AvARRAY(av) - AvALLOC(av);
while (key)
AvALLOC(av)[--key] = NULL;
AvREIFY_off(av);
AvREAL_on(av);
}
/*
=for apidoc av_extend
Pre-extend an array. The C is the index to which the array should be
extended.
=cut
*/
void
Perl_av_extend(pTHX_ AV *av SSize_t key)
{
MAGIC *mg;
PERL_ARGS_ASSERT_AV_EXTEND;
assert(SvTYPE(av) == SVt_PVAV);
mg = SvTIED_mg((const SV *)av PERL_MAGIC_tied);
if (mg) {
SV *arg1 = sv_newmortal();
sv_setiv(arg1 (IV)(key + 1));
Perl_magic_methcall(aTHX_ MUTABLE_SV(av) mg SV_CONST(EXTEND) G_DISCARD 1
arg1);
return;
}
av_extend_guts(avkey&AvMAX(av)&AvALLOC(av)&AvARRAY(av));
}
/* The guts of av_extend. *Not* for general use! */
void
Perl_av_extend_guts(pTHX_ AV *av SSize_t key SSize_t *maxp SV ***allocp
SV ***arrayp)
{
PERL_ARGS_ASSERT_AV_EXTEND_GUTS;
if (key < -1) /* -1 is legal */
Perl_croak(aTHX_
“panic: av_extend_guts() negative count (%“IVdf“)“ (IV)key);
if (key > *maxp) {
SV** ary;
SSize_t tmp;
SSize_t newmax;
if (av && *allocp != *arrayp) {
ary = *allocp + AvFILLp(av) + 1;
tmp = *arrayp - *allocp;
Move(*arrayp *allocp AvFILLp(av)+1 SV*);
*maxp += tmp;
*arrayp = *allocp;
if (AvREAL(av)) {
while (tmp)
ary[--tmp] = NULL;
}
if (key > *maxp - 10) {
newmax = key + *maxp;
goto resize;
}
}
else {
if (*allocp) {
#ifdef Perl_safesysmalloc_size
/* Whilst it would be quite possible to move this logic around
(as I did in the SV code) so as to set AvMAX(av) early
based on calling Perl_safesysmalloc_size() immediately after
allocation I‘m not convinced that it is a great idea here.
In an array we have to loop round setting everything to
NULL which means wr
- 上一篇:黑客锁机源码.rar
- 下一篇:[CocosCreator]扑克翻牌效果
相关资源
- 黑客锁机源码.rar
- 增长黑客.pdf
- 最新GJB9001C:2017国军标一整套程序文
- oaid_sdk_1.0.23.zip200578
- dizhi1.rar
- 白金假肉鸡上线器.zip
- X破解专版.rar
- 大作家.rar
- WINDOWS黑客编程技术详解-配套代码.z
- TheCalculusLifesaver.zip
- [黑客攻防技术宝典Web实战篇].Dafydd.
- 黑客攻防从入门到精通(黑客与反黑
- 小豪辅助源码大全.zip
- gcoapa.rar
- Main.zip184976
- 小旋风蜘蛛池x6.zip
- 图灵数学·统计学丛书42-概率论基础教
- 笛卡尔几何附《方法论》《探求真理
- 28749194政府大楼智能安防系统方案-2
- windows游戏编程大师技巧.part08.rar
- 控制论与科学方法论金观涛.pdf
- doudizhu.rar
- 服务器风云私服游戏网关.rar
- 2-数理统计学教程陈希孺编著2009中科
- 黑客之道漏洞发掘的艺术第2版.pdf
- 苹果数据恢复大师完美绿色破解版[亲
- FFVideoPlyer_视频读帧解码播放.rar
- WINDOWS7设备驱动程序开发_12867221_美里
- ffmpeg提取mp4关键帧保存为jpg.zip
-
Macgo Windows Blu-ray Pla
yer 2.11中文注册
评论
共有 条评论