libgee r13 - in trunk: . gee



Author: juergbi
Date: Tue Jan 22 13:10:20 2008
New Revision: 13
URL: http://svn.gnome.org/viewvc/libgee?rev=13&view=rev

Log:
2008-01-22  Juerg Billeter  <j bitron ch>

	* gee/hashmap.vala, gee/hashset.vala: remove unneeded type casts

	* gee/Makefile.am: don't use filter function in makefiles as it's a
	  GNU make extension


Modified:
   trunk/ChangeLog
   trunk/gee/Makefile.am
   trunk/gee/hashmap.vala
   trunk/gee/hashset.vala

Modified: trunk/gee/Makefile.am
==============================================================================
--- trunk/gee/Makefile.am	(original)
+++ trunk/gee/Makefile.am	Tue Jan 22 13:10:20 2008
@@ -1,6 +1,7 @@
 NULL =
 
-INCLUDES = \
+AM_CPPFLAGS = \
+	-I$(top_srcdir) \
 	$(GLIB_CFLAGS) \
 	$(NULL)
 
@@ -10,69 +11,35 @@
 	libgee.la
 	$(NULL)
 
-libgee_la_SOURCES = \
-	gee.vala.stamp \
-	arraylist.c \
-	arraylist.h \
+libgee_la_VALASOURCES = \
 	arraylist.vala \
-	collection.c \
-	collection.h \
 	collection.vala \
-	hashmap.c \
-	hashmap.h \
 	hashmap.vala \
-	hashset.c \
-	hashset.h \
 	hashset.vala \
-	iterable.c \
-	iterable.h \
 	iterable.vala \
-	iterator.c \
-	iterator.h \
 	iterator.vala \
-	list.c \
-	list.h \
 	list.vala \
-	map.c \
-	map.h \
 	map.vala \
-	readonlycollection.c \
-	readonlycollection.h \
 	readonlycollection.vala \
-	readonlylist.c \
-	readonlylist.h \
 	readonlylist.vala \
-	readonlymap.c \
-	readonlymap.h \
 	readonlymap.vala \
-	readonlyset.c \
-	readonlyset.h \
 	readonlyset.vala \
-	set.c \
-	set.h \
 	set.vala \
 	$(NULL)
 
+libgee_la_SOURCES = \
+	gee.vala.stamp \
+	$(libgee_la_VALASOURCES:.vala=.c) \
+	$(libgee_la_VALASOURCES:.vala=.h) \
+	$(NULL)
+
 geeincludedir = $(includedir)/gee-1.0/gee
 
 geeinclude_HEADERS = \
-	arraylist.h \
-	collection.h \
-	gee.h \
-	hashmap.h \
-	hashset.h \
-	iterable.h \
-	iterator.h \
-	list.h \
-	map.h \
-	readonlycollection.h \
-	readonlylist.h \
-	readonlymap.h \
-	readonlyset.h \
-	set.h \
+	$(libgee_la_VALASOURCES:.vala=.h) \
 	$(NULL)
 
-gee-1.0.vapi gee.vala.stamp: $(filter %.vala,$(libgee_la_SOURCES))
+gee-1.0.vapi gee.vala.stamp: $(libgee_la_VALASOURCES)
 	$(VALAC) --basedir $(top_srcdir) --library gee-1.0 $^
 	touch $@
 
@@ -86,4 +53,4 @@
 	gee-1.0.vapi \
 	$(NULL)
 
-EXTRA_DIST = gee-1.0.vapi gee.vala.stamp
+EXTRA_DIST = $(libgee_la_VALASOURCES) gee-1.0.vapi gee.vala.stamp

Modified: trunk/gee/hashmap.vala
==============================================================================
--- trunk/gee/hashmap.vala	(original)
+++ trunk/gee/hashmap.vala	Tue Jan 22 13:10:20 2008
@@ -2,7 +2,7 @@
  *
  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
  * Copyright (C) 1997-2000  GLib Team and others
- * Copyright (C) 2007  JÃrg Billeter
+ * Copyright (C) 2007-2008  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -77,8 +77,8 @@
 	private Node<K,V>** lookup_node (K key) {
 		uint hash_value = _key_hash_func (key);
 		Node<K,V>** node = &_nodes[hash_value % _array_size];
-		while ((*node) != null && (hash_value != ((Node<K,V>) (*node)).key_hash || !_key_equal_func (((Node<K,V>) (*node)).key, key))) {
-			node = &(((Node<K,V>) (*node)).next);
+		while ((*node) != null && (hash_value != (*node)->key_hash || !_key_equal_func ((*node)->key, key))) {
+			node = &((*node)->next);
 		}
 		return node;
 	}
@@ -89,9 +89,9 @@
 	}
 
 	public V get (K key) {
-		weak Node<K,V> node = (Node<K,V>) (*lookup_node (key));
+		Node<K,V>* node = (*lookup_node (key));
 		if (node != null) {
-			return node.value;
+			return node->value;
 		} else {
 			return null;
 		}
@@ -100,7 +100,7 @@
 	public void set (K key, V value) {
 		Node<K,V>** node = lookup_node (key);
 		if (*node != null) {
-			((Node<K,V>) (*node)).value = value;
+			(*node)->value = value;
 		} else {
 			uint hash_value = _key_hash_func (key);
 			*node = new Node<K,V> (key, value, hash_value);
@@ -113,9 +113,9 @@
 	public bool remove (K key) {
 		Node<K,V>** node = lookup_node (key);
 		if (*node != null) {
-			((Node<K,V>) (*node)).key = null;
-			((Node<K,V>) (*node)).value = null;
-			*node = ((Node<K,V>) (*node)).next;
+			(*node)->key = null;
+			(*node)->value = null;
+			*node = (*node)->next;
 			_nnodes--;
 			resize ();
 			_stamp++;
@@ -271,6 +271,7 @@
 
 		public bool add (V value) {
 			assert_not_reached ();
+			return false;
 		}
 
 		public void clear () {
@@ -279,6 +280,7 @@
 
 		public bool remove (V value) {
 			assert_not_reached ();
+			return false;
 		}
 
 		public bool contains (V value) {

Modified: trunk/gee/hashset.vala
==============================================================================
--- trunk/gee/hashset.vala	(original)
+++ trunk/gee/hashset.vala	Tue Jan 22 13:10:20 2008
@@ -2,7 +2,7 @@
  *
  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
  * Copyright (C) 1997-2000  GLib Team and others
- * Copyright (C) 2007  JÃrg Billeter
+ * Copyright (C) 2007-2008  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -64,8 +64,8 @@
 	private Node<G>** lookup_node (G key) {
 		uint hash_value = _hash_func (key);
 		Node<G>** node = &_nodes[hash_value % _array_size];
-		while ((*node) != null && (hash_value != ((Node<G>) (*node)).key_hash || !_equal_func (((Node<G>) (*node)).key, key))) {
-			node = &(((Node<G>) (*node)).next);
+		while ((*node) != null && (hash_value != (*node)->key_hash || !_equal_func ((*node)->key, key))) {
+			node = &((*node)->next);
 		}
 		return node;
 	}
@@ -96,8 +96,8 @@
 	public bool remove (G key) {
 		Node<G>** node = lookup_node (key);
 		if (*node != null) {
-			((Node<G>) (*node)).key = null;
-			*node = ((Node<G>) (*node)).next;
+			(*node)->key = null;
+			*node = (*node)->next;
 			_nnodes--;
 			resize ();
 			_stamp++;



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