[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] In build system hashing problem.

From: Patrick Mayweg <mayweg_at_qint.de>
Date: 2004-05-30 17:14:34 CEST

Hi,
In the building system there is the class "DependencyNode" in the file
build/generator/gen_base.py. This class defines the methods __hash__ and
__cmp__,which uses the member "filename" for hashing and comparision.
The derived class "TargetJava" set "filename" to '' so all objects
of the derived classes "TargetJavaClasses" and "TargetJavaHeaders"
are for hashing and comparision the same objects. This is wrong. The
patch uses the member "name" if the member "filename" contains an empty
string for hashing and comparision.

Patrick

[[[
 * build/generator/gen_base.py
   DependencyNode.__hash__
     use member name of member filename contains an empty string
   DependencyNode.__cmp__
     use member name of member filename contains an empty string
]]]

Index: build/generator/gen_base.py
===================================================================
--- build/generator/gen_base.py (revision 9908)
+++ build/generator/gen_base.py (working copy)
@@ -255,10 +255,19 @@
     return self.filename
 
   def __cmp__(self, ob):
- return cmp(self.filename, ob.filename)
+ myname = self.filename
+ if myname == '':
+ myname = self.name
+ othername = ob.filename
+ if othername == '':
+ othername = ob.name
+ return cmp(myname, othername)
 
   def __hash__(self):
- return hash(self.filename)
+ myname = self.filename
+ if myname == '':
+ myname = self.name
+ return hash(myname)
 
 class ObjectFile(DependencyNode):
   def __init__(self, filename, compile_cmd = None):

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun May 30 17:14:47 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.