diff options
author | rjray <devnull@localhost> | 2000-10-12 05:09:16 +0000 |
---|---|---|
committer | rjray <devnull@localhost> | 2000-10-12 05:09:16 +0000 |
commit | ead6af89ab9be825ecdfe034115b14e93e2292a1 (patch) | |
tree | 6d0965f11227e9ffe1e39a6d3f73d5151b2192b4 /Perl-RPM/RPM/Header.xs | |
parent | 8d85374707430b2a50388d886b6c6ef1c74abf79 (diff) | |
download | librpm-tizen-ead6af89ab9be825ecdfe034115b14e93e2292a1.tar.gz librpm-tizen-ead6af89ab9be825ecdfe034115b14e93e2292a1.tar.bz2 librpm-tizen-ead6af89ab9be825ecdfe034115b14e93e2292a1.zip |
Added a bug fix, removed an unused var, and added a constant() with AUTOLOAD
CVS patchset: 4209
CVS date: 2000/10/12 05:09:16
Diffstat (limited to 'Perl-RPM/RPM/Header.xs')
-rw-r--r-- | Perl-RPM/RPM/Header.xs | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/Perl-RPM/RPM/Header.xs b/Perl-RPM/RPM/Header.xs index 4af449961..fc6da1f94 100644 --- a/Perl-RPM/RPM/Header.xs +++ b/Perl-RPM/RPM/Header.xs @@ -4,7 +4,7 @@ #include "RPM.h" -static char * const rcsid = "$Id: Header.xs,v 1.18 2000/10/08 10:06:58 rjray Exp $"; +static char * const rcsid = "$Id: Header.xs,v 1.19 2000/10/12 05:09:16 rjray Exp $"; static int scalar_tag(pTHX_ SV *, int); /* @@ -23,6 +23,39 @@ static int scalar_tag(pTHX_ SV *, int); (header) = ((s_ptr) && SvOK(*(s_ptr))) ? (RPM_Header *)SvIV(*(s_ptr)) : NULL; +/* Any constants that are specific to the RPM::Header class will be exported + from here, via this C-level constant() routine */ +static int constant(pTHX_ char *name) +{ + errno = 0; + + if (strncmp((const char *)name, "RPM_HEADER_", 11)) + { + errno = ENOENT; + return 0; + } + else + { + name += 11; + switch (*name) + { + case 'M': + if (strEQ(name, "MASK")) +#ifdef RPM_HEADER_MASK + return RPM_HEADER_MASK; +#endif + case 'R': + if (strEQ(name, "READONLY")) +#ifdef RPM_HEADER_READONLY + return RPM_HEADER_READONLY; +#endif + default: + errno = EINVAL; + return 0; + } + } +} + /* Some simple functions to manage key-to-SV* transactions, since these gets used frequently. */ const char* sv2key(pTHX_ SV* key) @@ -434,7 +467,7 @@ int rpmhdr_STORE(pTHX_ RPM__Header self, SV* key, SV* value) rpm_error(aTHX_ RPMERR_BADARG, errmsg); return 0; } - is_scalar = scalar_tag(Nullsv, num_ent); + is_scalar = scalar_tag(aTHX_ Nullsv, num_ent); if (SvROK(value)) { /* @@ -1369,3 +1402,12 @@ rpmhdr_source_name(self) RETVAL = rpmhdr_source_name(self); OUTPUT: RETVAL + +int +constant(name) + char* name; + PROTOTYPE: $ + CODE: + RETVAL = constant(aTHX_ name); + OUTPUT: + RETVAL |