guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-4-51-ga07


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-4-51-ga07010b
Date: Mon, 26 Oct 2009 23:25:59 +0000

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 Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=a07010bf1828704edd9a40cadb0eaf820b8f3638

The branch, master has been updated
       via  a07010bf1828704edd9a40cadb0eaf820b8f3638 (commit)
       via  f044da55c5b0c0cf444a25e5bd9a76fea5a95f2d (commit)
      from  f916cbc4b17165491e7bfe64be4b56913fdacce6 (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 a07010bf1828704edd9a40cadb0eaf820b8f3638
Author: Ludovic Courtès <address@hidden>
Date:   Mon Oct 26 23:56:03 2009 +0100

    Use proper fold/for-each function types in `hashtab.h'.
    
    * libguile/hashtab.h (scm_t_hash_fold_fn, scm_t_hash_handle_fn): New
      types.
      (scm_internal_hash_fold, scm_internal_hash_for_each_handle): Use them.
    
    * libguile/hashtab.c (scm_internal_hash_fold): Take an
      `scm_t_hash_fold_fn'.  Update callers.
      (scm_internal_hash_for_each_handle): Take an `scm_t_hash_handle_fn'.
      Update callers.

commit f044da55c5b0c0cf444a25e5bd9a76fea5a95f2d
Author: Ludovic Courtès <address@hidden>
Date:   Mon Oct 26 23:38:13 2009 +0100

    Use proper assoc/hash function types in `hashtab.c'.
    
    This is a followup to d587c9e8b27219e68f8813fb648fc6913c93be0f ("Use
    proper types for hash/assoc functions in `hashtab.h'.").
    
    * libguile/hashtab.c (scm_i_rehash, scm_hash_fn_create_handle_x,
      scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Use
      `scm_t_hash_fn' and `scm_t_assoc_fn' as appropriate.

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

Summary of changes:
 libguile/hashtab.c |   36 +++++++++++++++++++++---------------
 libguile/hashtab.h |   20 ++++++++++++--------
 2 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/libguile/hashtab.c b/libguile/hashtab.c
index 69d604a..4ba2ef9 100644
--- a/libguile/hashtab.c
+++ b/libguile/hashtab.c
@@ -207,7 +207,7 @@ make_hash_table (int flags, unsigned long k, const char 
*func_name)
 
 void
 scm_i_rehash (SCM table,
-             unsigned long (*hash_fn)(),
+             scm_t_hash_fn hash_fn,
              void *closure,
              const char* func_name)
 {
@@ -472,8 +472,9 @@ scm_hash_fn_get_handle (SCM table, SCM obj,
 
 
 SCM
-scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, unsigned long 
(*hash_fn)(),
-                             SCM (*assoc_fn)(), void * closure)
+scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init,
+                            scm_t_hash_fn hash_fn, scm_t_assoc_fn assoc_fn,
+                             void * closure)
 #define FUNC_NAME "scm_hash_fn_create_handle_x"
 {
   int weak = 0;
@@ -563,9 +564,10 @@ scm_hash_fn_create_handle_x (SCM table, SCM obj, SCM init, 
unsigned long (*hash_
 #undef FUNC_NAME
 
 
-SCM 
-scm_hash_fn_ref (SCM table, SCM obj, SCM dflt, unsigned long (*hash_fn)(),
-                 SCM (*assoc_fn)(), void * closure)
+SCM
+scm_hash_fn_ref (SCM table, SCM obj, SCM dflt,
+                scm_t_hash_fn hash_fn, scm_t_assoc_fn assoc_fn,
+                 void *closure)
 {
   SCM it = scm_hash_fn_get_handle (table, obj, hash_fn, assoc_fn, closure);
   if (scm_is_pair (it))
@@ -577,9 +579,10 @@ scm_hash_fn_ref (SCM table, SCM obj, SCM dflt, unsigned 
long (*hash_fn)(),
 
 
 
-SCM 
-scm_hash_fn_set_x (SCM table, SCM obj, SCM val, unsigned long (*hash_fn)(),
-                   SCM (*assoc_fn)(), void * closure)
+SCM
+scm_hash_fn_set_x (SCM table, SCM obj, SCM val,
+                  scm_t_hash_fn hash_fn, scm_t_assoc_fn assoc_fn,
+                   void *closure)
 {
   SCM it;
 
@@ -591,8 +594,8 @@ scm_hash_fn_set_x (SCM table, SCM obj, SCM val, unsigned 
long (*hash_fn)(),
 
 SCM
 scm_hash_fn_remove_x (SCM table, SCM obj,
-                     unsigned long (*hash_fn)(),
-                     SCM (*assoc_fn)(),
+                     scm_t_hash_fn hash_fn,
+                     scm_t_assoc_fn assoc_fn,
                       void *closure)
 {
   int weak = 0;
@@ -1036,7 +1039,8 @@ SCM_DEFINE (scm_hashx_remove_x, "hashx-remove!", 4, 0, 0,
 static const char s_scm_hash_fold[];
 
 SCM
-scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM init, SCM table)
+scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
+                       SCM init, SCM table)
 {
   long i, n;
   SCM buckets, result = init;
@@ -1100,7 +1104,8 @@ scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM 
init, SCM table)
 static const char s_scm_hash_for_each[];
 
 void
-scm_internal_hash_for_each_handle (SCM (*fn) (), void *closure, SCM table)
+scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn, void *closure,
+                                  SCM table)
 {
   long i, n;
   SCM buckets;
@@ -1142,7 +1147,8 @@ SCM_DEFINE (scm_hash_fold, "hash-fold", 3, 0, 0,
   SCM_VALIDATE_PROC (1, proc);
   if (!SCM_HASHTABLE_P (table))
     SCM_VALIDATE_VECTOR (3, table);
-  return scm_internal_hash_fold (scm_call_3, (void *) SCM_UNPACK (proc), init, 
table);
+  return scm_internal_hash_fold ((scm_t_hash_fold_fn) scm_call_3,
+                                (void *) SCM_UNPACK (proc), init, table);
 }
 #undef FUNC_NAME
 
@@ -1182,7 +1188,7 @@ SCM_DEFINE (scm_hash_for_each_handle, 
"hash-for-each-handle", 2, 0, 0,
   if (!SCM_HASHTABLE_P (table))
     SCM_VALIDATE_VECTOR (2, table);
   
-  scm_internal_hash_for_each_handle (call,
+  scm_internal_hash_for_each_handle ((scm_t_hash_handle_fn) call,
                                     (void *) SCM_UNPACK (proc),
                                     table);
   return SCM_UNSPECIFIED;
diff --git a/libguile/hashtab.h b/libguile/hashtab.h
index f72e8ab..b60cd43 100644
--- a/libguile/hashtab.h
+++ b/libguile/hashtab.h
@@ -72,6 +72,14 @@ typedef unsigned long (*scm_t_hash_fn) (SCM obj, unsigned 
long max,
    some equality predicate.  */
 typedef SCM (*scm_t_assoc_fn) (SCM obj, SCM alist, void *closure);
 
+/* Function to fold over the entries of a hash table.  */
+typedef SCM (*scm_t_hash_fold_fn) (void *closure, SCM key, SCM value,
+                                  SCM result);
+
+/* Function to iterate over the handles (key-value pairs) of a hash
+   table.  */
+typedef SCM (*scm_t_hash_handle_fn) (void *closure, SCM handle);
+
 typedef struct scm_t_hashtable {
   int flags;                   /* properties of table */
   unsigned long n_items;       /* number of items in table */
@@ -84,12 +92,6 @@ typedef struct scm_t_hashtable {
 
 
 
-#if 0
-typedef unsigned int scm_t_hash_fn (SCM obj, unsigned int d, void *closure);
-typedef SCM scm_t_assoc_fn (SCM key, SCM alist, void *closure);
-typedef SCM scm_t_delete_fn (SCM elt, SCM list);
-#endif
-
 SCM_API SCM scm_vector_to_hash_table (SCM vector);
 SCM_API SCM scm_c_make_hash_table (unsigned long k);
 SCM_API SCM scm_make_hash_table (SCM n);
@@ -126,8 +128,10 @@ SCM_API SCM scm_hash_fn_remove_x (SCM table, SCM obj,
                                  scm_t_hash_fn hash_fn,
                                  scm_t_assoc_fn assoc_fn,
                                  void *closure);
-SCM_API SCM scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM init, SCM 
table);
-SCM_API void scm_internal_hash_for_each_handle (SCM (*fn) (), void *closure, 
SCM table);
+SCM_API SCM scm_internal_hash_fold (scm_t_hash_fold_fn fn, void *closure,
+                                   SCM init, SCM table);
+SCM_API void scm_internal_hash_for_each_handle (scm_t_hash_handle_fn fn,
+                                               void *closure, SCM table);
 SCM_API SCM scm_hash_clear_x (SCM table);
 
 SCM_API SCM scm_hashq_get_handle (SCM table, SCM obj);


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]