git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Eliminate Scalar::Util for something simpler

From
Petr Baudis <pasky@suse.cz>
Date
Jul 3, 2006, 21:49 UTC
Message-ID
<20060703214956.GP29115@pasky.or.cz>
In-Reply-To
<20060703204803.28541.67315.stgit@machine.or.cz>

Dear diary, on Mon, Jul 03, 2006 at 10:48:03PM CEST, I got a letter where Petr Baudis <pasky@suse.cz> said that...

> +		xs__call_gate(Scalar::Util::refaddr($self), $self->repo_path());
This was silly and requires Scalar::Util.
->8-
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 perl/Git.pm |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index 65acaa7..f2467bd 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -92,13 +92,14 @@ increate nonwithstanding).
 use Carp qw(carp croak); # but croak is bad - throw instead
 use Error qw(:try);
 use Cwd qw(abs_path);
-use Scalar::Util;
 
 require XSLoader;
 XSLoader::load('Git', $VERSION);
 
 }
 
+my $instance_id = 0;
+
 
 =head1 CONSTRUCTORS
 
@@ -216,7 +217,7 @@ sub repository {
 		delete $opts{Directory};
 	}
 
-	$self = { opts => \%opts };
+	$self = { opts => \%opts, id => $instance_id++ };
 	bless $self, $class;
 }
 
@@ -855,7 +856,7 @@ sub _call_gate {
 		# For now, when we will need to do it we could temporarily
 		# chdir() there and then chdir() back after the call is done.
 
-		xs__call_gate(Scalar::Util::refaddr($self), $self->repo_path());
+		xs__call_gate($self->{id}, $self->repo_path());
 	}
 
 	# Having to call throw from the C code is a sure path to insanity.
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam
Previous: Petr BaudisNext: Petr Baudis
Message 7 of 9 in “The residual Git.pm patches”
  1. 0/6 The residual Git.pm patchesPetr Baudis, Jul 3, 2006
  2. 1/6 Git.pm: Add config() methodPetr Baudis, Jul 3, 2006
  3. 2/6 Convert git-send-email to use Git.pmPetr Baudis, Jul 3, 2006
  4. 3/6 Git.pm: Introduce ident() and ident_person() methodsPetr Baudis, Jul 3, 2006
  5. 4/6 Make it possible to set up libgit directly (instead of from the environment)Petr Baudis, Jul 3, 2006
  6. Petr BaudisJul 3, 2006
  7. Eliminate Scalar::Util for something simplerPetr Baudis, Jul 3, 2006
  8. 5/6 Git.pm: Introduce fast get_object() methodPetr Baudis, Jul 3, 2006
  9. 6/6 Convert git-annotate to use Git.pmPetr Baudis, Jul 3, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.