public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Revert gas/hash.? and binutils/bucomm.?
@ 2005-04-29 17:47 H. J. Lu
  0 siblings, 0 replies; only message in thread
From: H. J. Lu @ 2005-04-29 17:47 UTC (permalink / raw)
  To: binutils; +Cc: bje

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

I checked in the following patches to revert the last changes to
gas/hash.? and binutils/bucomm.?. hash_replace and hash_delete are
used by some assemblers. report is used by dlltool.c.


H.J.

[-- Attachment #2: b --]
[-- Type: text/plain, Size: 1503 bytes --]

? autom4te.cache
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/binutils/ChangeLog,v
retrieving revision 1.919
diff -u -p -r1.919 ChangeLog
--- ChangeLog	29 Apr 2005 01:15:21 -0000	1.919
+++ ChangeLog	29 Apr 2005 16:49:00 -0000
@@ -1,3 +1,8 @@
+2005-04-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* bucomm.c: Undo the last change.
+	* bucomm.h: Likewise.
+
 2005-04-29  Ben Elliston  <bje@au.ibm.com>
 
 	* syslex.l (word, number, unit): Remove unused variables.
Index: bucomm.c
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.c,v
retrieving revision 1.21
diff -u -p -r1.21 bucomm.c
--- bucomm.c	29 Apr 2005 00:03:32 -0000	1.21
+++ bucomm.c	29 Apr 2005 16:49:00 -0000
@@ -65,7 +65,7 @@ bfd_fatal (const char *string)
   xexit (1);
 }
 
-static void
+void
 report (const char * format, va_list args)
 {
   fprintf (stderr, "%s: ", program_name);
Index: bucomm.h
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.h,v
retrieving revision 1.12
diff -u -p -r1.12 bucomm.h
--- bucomm.h	29 Apr 2005 00:03:32 -0000	1.12
+++ bucomm.h	29 Apr 2005 16:49:00 -0000
@@ -152,6 +152,8 @@ void bfd_nonfatal (const char *);
 
 void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
 
+void report (const char *, va_list);
+
 void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 
 void non_fatal (const char *, ...) ATTRIBUTE_PRINTF_1;

[-- Attachment #3: g --]
[-- Type: text/plain, Size: 3420 bytes --]

? autom4te.cache
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.2505
diff -u -p -r1.2505 ChangeLog
--- ChangeLog	29 Apr 2005 00:22:23 -0000	1.2505
+++ ChangeLog	29 Apr 2005 16:54:58 -0000
@@ -1,3 +1,8 @@
+2005-04-29  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* hash.c: Undo the last change.
+	* hash.h: Likewise.
+
 2005-04-29  Ben Elliston  <bje@au.ibm.com>
 
 	* Makefile.am (GAS_CFILES): Remove bignum-copy.c.
Index: hash.c
===================================================================
RCS file: /cvs/src/src/gas/hash.c,v
retrieving revision 1.16
diff -u -p -r1.16 hash.c
--- hash.c	29 Apr 2005 00:22:26 -0000	1.16
+++ hash.c	29 Apr 2005 16:54:58 -0000
@@ -294,6 +294,31 @@ hash_jam (struct hash_control *table, co
   return NULL;
 }
 
+/* Replace an existing entry in a hash table.  This returns the old
+   value stored for the entry.  If the entry is not found in the hash
+   table, this does nothing and returns NULL.  */
+
+PTR
+hash_replace (struct hash_control *table, const char *key, PTR value)
+{
+  struct hash_entry *p;
+  PTR ret;
+
+  p = hash_lookup (table, key, NULL, NULL);
+  if (p == NULL)
+    return NULL;
+
+#ifdef HASH_STATISTICS
+  ++table->replacements;
+#endif
+
+  ret = p->data;
+
+  p->data = value;
+
+  return ret;
+}
+
 /* Find an entry in a hash table, returning its value.  Returns NULL
    if the entry is not found.  */
 
@@ -309,6 +334,35 @@ hash_find (struct hash_control *table, c
   return p->data;
 }
 
+/* Delete an entry from a hash table.  This returns the value stored
+   for that entry, or NULL if there is no such entry.  */
+
+PTR
+hash_delete (struct hash_control *table, const char *key)
+{
+  struct hash_entry *p;
+  struct hash_entry **list;
+
+  p = hash_lookup (table, key, &list, NULL);
+  if (p == NULL)
+    return NULL;
+
+  if (p != *list)
+    abort ();
+
+#ifdef HASH_STATISTICS
+  ++table->deletions;
+#endif
+
+  *list = p->next;
+
+  /* Note that we never reclaim the memory for this entry.  If gas
+     ever starts deleting hash table entries in a big way, this will
+     have to change.  */
+
+  return p->data;
+}
+
 /* Traverse a hash table.  Call the function on every entry in the
    hash table.  */
 
Index: hash.h
===================================================================
RCS file: /cvs/src/src/gas/hash.h,v
retrieving revision 1.9
diff -u -p -r1.9 hash.h
--- hash.h	29 Apr 2005 00:22:26 -0000	1.9
+++ hash.h	29 Apr 2005 16:54:58 -0000
@@ -51,11 +51,23 @@ extern const char *hash_insert (struct h
 extern const char *hash_jam (struct hash_control *,
 			     const char *key, PTR value);
 
+/* Replace an existing entry in a hash table.  This returns the old
+   value stored for the entry.  If the entry is not found in the hash
+   table, this does nothing and returns NULL.  */
+
+extern PTR hash_replace (struct hash_control *, const char *key,
+			 PTR value);
+
 /* Find an entry in a hash table, returning its value.  Returns NULL
    if the entry is not found.  */
 
 extern PTR hash_find (struct hash_control *, const char *key);
 
+/* Delete an entry from a hash table.  This returns the value stored
+   for that entry, or NULL if there is no such entry.  */
+
+extern PTR hash_delete (struct hash_control *, const char *key);
+
 /* Traverse a hash table.  Call the function on every entry in the
    hash table.  */
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-29 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-29 17:47 PATCH: Revert gas/hash.? and binutils/bucomm.? H. J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).