[SCM] GNU M4 source repository branch, branch-1.6, updated. v1.5.89a-126-g5165ce0

"Eric Blake" <[email protected]> Tue, 16 Jun 2009 03:25:57 +0000
Newsgroups gmane.comp.gnu.m4.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=5165ce08a8784648f4fa0fafe2d3005569f16bdd

The branch, branch-1.6 has been updated
       via  5165ce08a8784648f4fa0fafe2d3005569f16bdd (commit)
      from  fb90c01769331d12b77320a1c4567281dea1b070 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5165ce08a8784648f4fa0fafe2d3005569f16bdd
Author: Eric Blake <[email protected]>
Date:   Mon Jun 15 09:17:41 2009 -0600

    Properly manage hash return values.
    
    * src/symtab.c (symtab_init, lookup_symbol): React to allocation
    failure.
    * local/lib/hash.c.diff: New file to silence gcc warning, until
    such time as upstream gnulib hash module is patched to avoid
    memory leak.
    * .gitattributes: Ignore spacing in diff.
    
    Signed-off-by: Eric Blake <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 .gitattributes        |    3 +++
 ChangeLog             |   10 ++++++++++
 local/lib/hash.c.diff |   27 +++++++++++++++++++++++++++
 src/symtab.c          |   17 ++++++++++++++---
 4 files changed, 54 insertions(+), 3 deletions(-)
 create mode 100644 local/lib/hash.c.diff

diff --git a/.gitattributes b/.gitattributes
index 68d2d12..1b29560 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,3 +2,6 @@
 # needed for using these attributes effectively.
 ChangeLog merge=merge-changelog
 *.texi* diff=texinfo
+# Ignore whitespace in any gnulib local patches.
+local/* -whitespace
+local/*/* -whitespace
diff --git a/ChangeLog b/ChangeLog
index 3b3ca90..c9169f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-06-15  Eric Blake  <[email protected]>
+
+	Properly manage hash return values.
+	* src/symtab.c (symtab_init, lookup_symbol): React to allocation
+	failure.
+	* local/lib/hash.c.diff: New file to silence gcc warning, until
+	such time as upstream gnulib hash module is patched to avoid
+	memory leak.
+	* .gitattributes: Ignore spacing in diff.
+
 2009-06-13  Eric Blake  <[email protected]>
 
 	Fix testsuite failure.
diff --git a/local/lib/hash.c.diff b/local/lib/hash.c.diff
new file mode 100644
index 0000000..8d27a36
--- /dev/null
+++ b/local/lib/hash.c.diff
@@ -0,0 +1,27 @@
+diff --git a/lib/hash.c b/lib/hash.c
+index 7d76d45..6f3a5c6 100644
+--- a/lib/hash.c
++++ b/lib/hash.c
+@@ -1,7 +1,7 @@
+ /* hash - hashing table processing.
+
+-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free
+-   Software Foundation, Inc.
++   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007,
++   2009 Free Software Foundation, Inc.
+
+    Written by Jim Meyering, 1992.
+
+@@ -1012,7 +1012,11 @@ hash_delete (Hash_table *table, const void *entry)
+ 		 : (table->n_buckets * tuning->shrink_factor
+ 		    * tuning->growth_threshold));
+
+-	      hash_rehash (table, candidate);
++	      if (hash_rehash (table, candidate))
++		{
++		  /* Failure to allocate memory in an attempt to
++		     shrink the table is not fatal.  */
++		}
+ 	    }
+ 	}
+     }
diff --git a/src/symtab.c b/src/symtab.c
index 6631e9c..338bf17 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -177,6 +177,8 @@ symtab_init (size_t size)
 {
   symtab = hash_initialize (size, NULL, symtab_hasher, symtab_comparator,
 			    symtab_free_entry);
+  if (!symtab)
+    xalloc_die ();
 
 #ifdef DEBUG_SYM
   atexit (show_profile); /* Ignore failure, since this is debug code.  */
@@ -277,7 +279,10 @@ lookup_symbol (const char *name, size_t len, symbol_lookup mode)
 		  assert (entry == old);
 		  sym->stack = sym;
 		  entry = (symbol *) hash_insert (symtab, sym);
-		  assert (sym == entry);
+		  if (entry)
+		    assert (sym == entry);
+		  else
+		    xalloc_die ();
 		}
 	      else
 		{
@@ -319,7 +324,10 @@ lookup_symbol (const char *name, size_t len, symbol_lookup mode)
 	{
 	  sym->stack = sym;
 	  entry = (symbol *) hash_insert (symtab, sym);
-	  assert (sym == entry);
+	  if (entry)
+	    assert (sym == entry);
+	  else
+	    xalloc_die ();
 	}
       return sym;
 
@@ -376,7 +384,10 @@ lookup_symbol (const char *name, size_t len, symbol_lookup mode)
 
 	    sym->stack = sym;
 	    entry = (symbol *) hash_insert (symtab, sym);
-	    assert (sym == entry);
+	    if (entry)
+	      assert (sym == entry);
+	    else
+	      xalloc_die ();
 	  }
 	return result;
       }


hooks/post-receive
-- 
GNU M4 source repository