#985331 hash.c: add type declarations as parameters to functions; add a "return 1" to "hdbmtohash()"

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-03-16 05:12:05 UTC
Severity:
normal
Tags:
#985331#5
Date:
2021-03-16 05:09:49 UTC
From:
To:
Dear Maintainer,

hash.c:

  Add a type declaration to empty parentheses.

  Add a "return 1" to function "hdbmtohash()"; unknown purpose!

  Add type declarations as parameters to the function "hashwalk()".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 hash.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/hash.c b/hash.c
index 07d0081..6a214ce 100644
--- a/hash.c
+++ b/hash.c
@@ -71,7 +71,7 @@ hashdef(register HASHDATUM key)
 #endif

 HASHTABLE      *
-hashcreate(unsigned size, unsigned (*hashfunc) ())
+hashcreate(unsigned size, unsigned (*hashfunc) (void))
  /* size		a crude guide to size */
 {
     return hdbmcreate(size, hashfunc);
@@ -146,7 +146,7 @@ hashdelete(HASHTABLE * tbl, register HASHDATUM key)

 struct translate {
     char           *realhook;
-    int             (*func) ();
+    int             (*func) (char *, char *, char *);
 };

 static int
@@ -155,6 +155,7 @@ hdbmtohash(HDBMDATUM key, HDBMDATUM data, char *hook)
     register struct translate *thp = (struct translate *) hook;

     (*thp->func) (key.dat_ptr, data.dat_ptr, thp->realhook);
+    return 1; /* added, unknown purpose */
 }

 /*
@@ -162,8 +163,14 @@ hdbmtohash(HDBMDATUM key, HDBMDATUM data, char *hook)
  * HDBMDATUM arguments to HASHDATUM arguments.  this also demonstrates
  * how to use the hook argument.
  */
+
 void
-                hashwalk(HASHTABLE * tbl, int (*nodefunc) (), char *hook)
+/* next line changed
+               hashwalk(HASHTABLE * tbl, int (*nodefunc) (), char *hook)
+*/
+                hashwalk(HASHTABLE * tbl, int (*nodefunc) (char *, char *,
+			 char *), char *hook)
+
  /* hook		(void *) really */
 {
     struct translate transhook;