From: Vincent Pit Date: Sun, 29 Jun 2008 16:41:27 +0000 (+0200) Subject: Importing Linux-SysInfo-0.06.tar.gz X-Git-Tag: v0.06 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4a20ade52e02363f70e1e5da48704bb7f171d3bc;p=perl%2Fmodules%2FLinux-SysInfo.git Importing Linux-SysInfo-0.06.tar.gz --- diff --git a/Changes b/Changes index 578f6bd..72f2a57 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Linux-SysInfo +0.06 2007-08-14 18:40 UTC + + Fix : Building for perl-5.6.x and perl-5.9.{3,4}. + 0.05 2007-08-13 11:10 UTC + Add : Kwalitee test. + Chg : Makefile.PL overhaul. diff --git a/META.yml b/META.yml index 36293a4..d73e14e 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Linux-SysInfo -version: 0.05 +version: 0.06 abstract: Perl interface to the sysinfo(2) Linux system call. license: perl generated_by: ExtUtils::MakeMaker version 6.36 diff --git a/README b/README index 3d0e626..a2a3f55 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call. VERSION - Version 0.05 + Version 0.06 SYNOPSIS use Linux::SysInfo qw/sysinfo/; diff --git a/SysInfo.xs b/SysInfo.xs index c2b268d..94cdf97 100644 --- a/SysInfo.xs +++ b/SysInfo.xs @@ -23,23 +23,26 @@ /* --- Keys ---------------------------------------------------------------- */ #define LS_KEY(K) (ls_key_##K##_sv) -#if PERL_API_REVISION >= 5 && PERL_API_VERSION >= 9 && PERL_API_SUBVERSION >= 5 -/* From 5.9.5, newSVpvn_share doesn't seem to fill the UV field of the key SV - * properly (the SV actually doesn't even look like a UV). That's why we have - * to keep the hash in another variable. */ +#if PERL_REVISION <= 4 || (PERL_REVISION == 5 && PERL_VERSION <= 6) +/* newSVpvn_share doesn't exist in perl-5.6.x */ # define LS_HASH(K) (ls_key_##K##_hash) -# define LS_KEY_DECLARE(K) STATIC SV *LS_KEY(K) = NULL; \ +# define LS_KEY_DECLARE(K) STATIC const char LS_KEY(K)[] = #K; \ STATIC U32 LS_HASH(K) = 0 -# define LS_KEY_DEFINE(K) PERL_HASH(LS_HASH(K), #K, sizeof(#K)-1); \ - LS_KEY(K) = newSVpvn_share(#K, sizeof(#K)-1, \ - LS_HASH(K)); -# define LS_KEY_STORE(H,K,V) hv_store_ent((H), LS_KEY(K), (V), LS_HASH(K)) +# define LS_KEY_DEFINE(K) PERL_HASH(LS_HASH(K), LS_KEY(K), sizeof(#K)-1) +# define LS_KEY_STORE(H,K,V) hv_store((H), LS_KEY(K), sizeof(#K)-1, \ + (V), LS_HASH(K)) #else -/* This won't work for 5.9.3 (5.9.4 ?), neither will the previous one. - * If you want to bleed, upgrade your blead! */ +# if PERL_REVISION >= 5 && PERL_VERSION >= 9 && PERL_SUBVERSION >= 3 +/* From perl-5.9.3 (#24802), the key is only a SVt_PV and one can get the hash + * value with the SvSHARED_HASH() macro. */ +# define LS_HASH(K) SvSHARED_HASH(LS_KEY(K)) +# else +/* Before, the key was a SVt_PVIV and the hash was stored in the UV field. */ +# define LS_HASH(K) SvUVX(LS_KEY(K)) +# endif # define LS_KEY_DECLARE(K) STATIC SV *LS_KEY(K) = NULL # define LS_KEY_DEFINE(K) LS_KEY(K) = newSVpvn_share(#K, sizeof(#K)-1, 0) -# define LS_KEY_STORE(H,K,V) hv_store_ent((H), LS_KEY(K), (V), SvUVX(LS_KEY(K))) +# define LS_KEY_STORE(H,K,V) hv_store_ent((H), LS_KEY(K), (V), LS_HASH(K)) #endif LS_KEY_DECLARE(uptime); diff --git a/lib/Linux/SysInfo.pm b/lib/Linux/SysInfo.pm index b99e4d4..e11d26b 100644 --- a/lib/Linux/SysInfo.pm +++ b/lib/Linux/SysInfo.pm @@ -9,11 +9,11 @@ Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call. =head1 VERSION -Version 0.05 +Version 0.06 =cut -our $VERSION = '0.05'; +our $VERSION = '0.06'; =head1 SYNOPSIS