aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2000-11-04 07:48:51 +0000
committerHans-Peter Nilsson <hp@axis.com>2000-11-04 07:48:51 +0000
commit82e7f05e13cc6fd05f1289378e863f25ff8d2f21 (patch)
treeccbf5cf245da61c0354e853b6cd30fb741cee753 /include
parent74f832daf0e6d104b3283160fcffe5b387905c13 (diff)
downloadgdb-82e7f05e13cc6fd05f1289378e863f25ff8d2f21.zip
gdb-82e7f05e13cc6fd05f1289378e863f25ff8d2f21.tar.gz
gdb-82e7f05e13cc6fd05f1289378e863f25ff8d2f21.tar.bz2
* hashtab.h (struct htab): Add member return_allocation_failure.
(htab_try_create): New prototype. Mention which functions may return NULL when this is used.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog6
-rw-r--r--include/hashtab.h10
2 files changed, 16 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 3811a7c..55b7927 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+2000-11-04 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * hashtab.h (struct htab): Add member return_allocation_failure.
+ (htab_try_create): New prototype. Mention which functions may
+ return NULL when this is used.
+
2000-11-03 Hans-Peter Nilsson <hp@bitrange.com>
* hashtab.h: Change void * to PTR where necessary.
diff --git a/include/hashtab.h b/include/hashtab.h
index c110ac5..a577c5e 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -98,6 +98,10 @@ struct htab
/* The following member is used for debugging. Its value is number
of collisions fixed for time of work with the hash table. */
unsigned int collisions;
+
+ /* This is non-zero if we are allowed to return NULL for function calls
+ that allocate memory. */
+ int return_allocation_failure;
};
typedef struct htab *htab_t;
@@ -109,6 +113,12 @@ enum insert_option {NO_INSERT, INSERT};
extern htab_t htab_create PARAMS ((size_t, htab_hash,
htab_eq, htab_del));
+
+/* This function is like htab_create, but may return NULL if memory
+ allocation fails, and also signals that htab_find_slot_with_hash and
+ htab_find_slot are allowed to return NULL when inserting. */
+extern htab_t htab_try_create PARAMS ((size_t, htab_hash,
+ htab_eq, htab_del));
extern void htab_delete PARAMS ((htab_t));
extern void htab_empty PARAMS ((htab_t));