From 5ea73ea3a1ffa23ca598fac117830664b66a2ebf Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 15 Mar 2022 22:35:45 +0100 Subject: [PATCH] Use the new library context system in the Perl module. --- perl-itkacl-2.0/debian/changelog | 5 --- perl-itkacl-2.0/itkacl.i | 20 --------- .../Makefile.PL | 0 perl-itkacl-2.2/debian/changelog | 11 +++++ .../debian/compat | 0 .../debian/control | 0 .../debian/copyright | 0 .../debian/rules | 0 perl-itkacl-2.2/itkacl.i | 44 +++++++++++++++++++ 9 files changed, 55 insertions(+), 25 deletions(-) delete mode 100644 perl-itkacl-2.0/debian/changelog delete mode 100644 perl-itkacl-2.0/itkacl.i rename {perl-itkacl-2.0 => perl-itkacl-2.2}/Makefile.PL (100%) create mode 100644 perl-itkacl-2.2/debian/changelog rename {perl-itkacl-2.0 => perl-itkacl-2.2}/debian/compat (100%) rename {perl-itkacl-2.0 => perl-itkacl-2.2}/debian/control (100%) rename {perl-itkacl-2.0 => perl-itkacl-2.2}/debian/copyright (100%) rename {perl-itkacl-2.0 => perl-itkacl-2.2}/debian/rules (100%) create mode 100644 perl-itkacl-2.2/itkacl.i diff --git a/perl-itkacl-2.0/debian/changelog b/perl-itkacl-2.0/debian/changelog deleted file mode 100644 index 0b335fd..0000000 --- a/perl-itkacl-2.0/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -libitkacl-perl (2.0) unstable; urgency=low - - * Initial release. - - -- Steinar H. Gunderson Tue, 14 May 2013 01:26:44 +0200 diff --git a/perl-itkacl-2.0/itkacl.i b/perl-itkacl-2.0/itkacl.i deleted file mode 100644 index f58703c..0000000 --- a/perl-itkacl-2.0/itkacl.i +++ /dev/null @@ -1,20 +0,0 @@ -/* SWIG interface for libitkacl */ -%module itkacl - -/* Convert errors to Perl exceptions and keep the interface clean. */ -%inline %{ - extern int itkacl_check(char *realm, char *user, char *errmsg, size_t errmsgsize); - int check(char *realm, char *user) - { - char errmsg[1024]; - int ret = itkacl_check(realm, user, errmsg, 1024); - - /* printf("check '%s' vs. '%s' gave %d\n", user, realm, ret); */ - if (ret == -1) - die(errmsg); - else - return (ret == 0); - } - -%} - diff --git a/perl-itkacl-2.0/Makefile.PL b/perl-itkacl-2.2/Makefile.PL similarity index 100% rename from perl-itkacl-2.0/Makefile.PL rename to perl-itkacl-2.2/Makefile.PL diff --git a/perl-itkacl-2.2/debian/changelog b/perl-itkacl-2.2/debian/changelog new file mode 100644 index 0000000..9040e7a --- /dev/null +++ b/perl-itkacl-2.2/debian/changelog @@ -0,0 +1,11 @@ +libitkacl-perl (2.2) unstable; urgency=medium + + * Use the new library contexts for higher performance with repeated calls. + + -- Steinar H. Gunderson Tue, 15 Mar 2022 22:24:46 +0100 + +libitkacl-perl (2.0) unstable; urgency=low + + * Initial release. + + -- Steinar H. Gunderson Tue, 14 May 2013 01:26:44 +0200 diff --git a/perl-itkacl-2.0/debian/compat b/perl-itkacl-2.2/debian/compat similarity index 100% rename from perl-itkacl-2.0/debian/compat rename to perl-itkacl-2.2/debian/compat diff --git a/perl-itkacl-2.0/debian/control b/perl-itkacl-2.2/debian/control similarity index 100% rename from perl-itkacl-2.0/debian/control rename to perl-itkacl-2.2/debian/control diff --git a/perl-itkacl-2.0/debian/copyright b/perl-itkacl-2.2/debian/copyright similarity index 100% rename from perl-itkacl-2.0/debian/copyright rename to perl-itkacl-2.2/debian/copyright diff --git a/perl-itkacl-2.0/debian/rules b/perl-itkacl-2.2/debian/rules similarity index 100% rename from perl-itkacl-2.0/debian/rules rename to perl-itkacl-2.2/debian/rules diff --git a/perl-itkacl-2.2/itkacl.i b/perl-itkacl-2.2/itkacl.i new file mode 100644 index 0000000..4523e81 --- /dev/null +++ b/perl-itkacl-2.2/itkacl.i @@ -0,0 +1,44 @@ +/* SWIG interface for libitkacl */ +%module itkacl + +%perlcode %{ +_itkacl_init(); +END { + _itkacl_deinit(); +} + +%} + +/* Convert errors to Perl exceptions and keep the interface clean. */ +%inline %{ + #include "itkacl.h" + + struct itkacl_ctx *_ctx = NULL; + + void _itkacl_init() + { + char errmsg[1024]; + _ctx = itkacl_create_ctx(errmsg, sizeof(errmsg)); + if (_ctx == NULL) + die(errmsg); + } + + void _itkacl_deinit() + { + itkacl_free_ctx(_ctx); + } + + int check(char *realm, char *user) + { + char errmsg[1024]; + int ret = itkacl_check_with_ctx(_ctx, realm, user, errmsg, 1024); + + /* printf("check '%s' vs. '%s' gave %d\n", user, realm, ret); */ + if (ret == -1) + die(errmsg); + else + return (ret == 0); + } + +%} + -- 2.39.2