texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XSLoader.pm (init): follow the DynaL


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XSLoader.pm (init): follow the DynaLoader documentation strictly on the return of dl_findfile, dl_load_file and dl_find_symbol. Cosmetic change for dl_undef_symbols return condition.
Date: Sun, 17 Nov 2024 17:38:52 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new c202a74a5f * tp/Texinfo/XSLoader.pm (init): follow the DynaLoader 
documentation strictly on the return of dl_findfile, dl_load_file and 
dl_find_symbol.  Cosmetic change for dl_undef_symbols return condition.
c202a74a5f is described below

commit c202a74a5fab37d3f3339b9535c29423a1d7ca3f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 17 23:38:47 2024 +0100

    * tp/Texinfo/XSLoader.pm (init): follow the DynaLoader documentation
    strictly on the return of dl_findfile, dl_load_file and
    dl_find_symbol.  Cosmetic change for dl_undef_symbols return
    condition.
---
 ChangeLog              |  7 +++++++
 tp/Texinfo/XSLoader.pm | 14 +++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 841a70f727..8d817ca482 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-11-17  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XSLoader.pm (init): follow the DynaLoader documentation
+       strictly on the return of dl_findfile, dl_load_file and
+       dl_find_symbol.  Cosmetic change for dl_undef_symbols return
+       condition.
+
 2024-11-17  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XSLoader.pm (_find_file): compare ref() with the empty
diff --git a/tp/Texinfo/XSLoader.pm b/tp/Texinfo/XSLoader.pm
index e2a5737434..8010f03b83 100644
--- a/tp/Texinfo/XSLoader.pm
+++ b/tp/Texinfo/XSLoader.pm
@@ -146,7 +146,6 @@ sub init {
   }
 
   my $dlname = undef;
-  my $dlpath = undef;
 
   my $fh;
   open $fh, $libtool_archive;
@@ -171,30 +170,31 @@ sub init {
   push @DynaLoader::dl_library_path, $libtool_dir;
   push @DynaLoader::dl_library_path, "$libtool_dir/.libs";
 
-  $dlpath = DynaLoader::dl_findfile($dlname);
-  if (!$dlpath) {
+  my @found_files = DynaLoader::dl_findfile($dlname);
+  if (scalar(@found_files) == 0) {
     _fatal("$module_name: couldn't find $dlname");
     goto FALLBACK;
   }
+  my $dlpath = $found_files[0];
 
   #my $flags = dl_load_flags $module; # This is 0 in DynaLoader
   my $flags = 0;
   my $libref = DynaLoader::dl_load_file($dlpath, $flags);
-  if (!$libref) {
+  if (!defined($libref)) {
     my $message = DynaLoader::dl_error();
     _fatal("$module_name: couldn't load file $dlpath: $message");
     goto FALLBACK;
   }
   _debug("$dlpath loaded");
   my @undefined_symbols = DynaLoader::dl_undef_symbols();
-  if ($#undefined_symbols+1 != 0) {
+  if (scalar(@undefined_symbols) != 0) {
     _fatal("$module_name: still have undefined symbols after dl_load_file");
   }
   my $bootname = "boot_$module";
   $bootname =~ s/:/_/g;
   _debug("looking for $bootname");
   my $symref = DynaLoader::dl_find_symbol($libref, $bootname);
-  if (!$symref) {
+  if (!defined($symref)) {
     _fatal("$module_name: couldn't find $bootname symbol");
     goto FALLBACK;
   }
@@ -202,7 +202,7 @@ sub init {
   my $boot_fn = DynaLoader::dl_install_xsub("${module}::bootstrap",
                                                   $symref, $dlname);
 
-  if (!$boot_fn) {
+  if (!defined($boot_fn)) {
     _fatal("$module_name: couldn't bootstrap");
     goto FALLBACK;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]