Source: nn
Version: 5.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From 68adae10902d62c3efeacdb1f86b334e0a115f10 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Wed, 17 Mar 2021 04:20:06 +0000
>Subject: [PATCH] hdbm.c: add a type declaration to empty parentheses; correct
> type with a cast

hdbm.c:

  Add a type declaration to an empty parenthesis in the functions
"hdbmcreate()", "hdbmentry()", and "hdbmwalk()".

  Add a cast in comparisons of "int" versus "unsigned int".

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 hdbm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/hdbm.c b/hdbm.c
index 6b8cbd2..1b47644 100644
--- a/hdbm.c
+++ b/hdbm.c
@@ -113,7 +113,7 @@ hdbmdef(register HDBMDATUM key)
 }
 
 HASHTABLE      *
-hdbmcreate(register unsigned size, unsigned (*hashfunc) ())
+hdbmcreate(register unsigned size, unsigned (*hashfunc) (void))
  /* size                       a crude guide to size */
 {
     register HASHTABLE *tbl;
@@ -163,7 +163,7 @@ hefree(register HASHENT * hp)
 void
 hdbmdestroy(register HASHTABLE * tbl)
 {
-    register unsigned idx;
+    register unsigned int idx;
     register HASHENT *hp, *next;
     register HASHENT **hepp;
     register int    tblsize;
@@ -172,7 +172,7 @@ hdbmdestroy(register HASHTABLE * tbl)
        return;
     tblsize = tbl->ht_size;
     hepp = tbl->ht_addr;
-    for (idx = 0; idx < tblsize; idx++) {
+    for (idx = 0; idx < (unsigned int) tblsize; idx++) {
        for (hp = hepp[idx]; hp != NULL; hp = next) {
            next = hp->he_next;
            hp->he_next = NULL;
@@ -208,7 +208,7 @@ hdbmfind(register HASHTABLE * tbl, HDBMDATUM key)
     hepp = &tbl->ht_addr[(*tbl->ht_hash) (key) % size];
     for (hp = *hepp; hp != NULL; prevhp = hp, hp = hp->he_next) {
        hpkeydat = hp->he_key.dat_ptr;
-       if (hp->he_key.dat_len == keylen && hpkeydat[0] == keydat[0] &&
+       if (hp->he_key.dat_len == (unsigned int) keylen && hpkeydat[0] == 
keydat[0] &&
            memcmp(hpkeydat, keydat, keylen) == 0)
            break;
     }
@@ -257,7 +257,7 @@ hdbmstore(register HASHTABLE * tbl, HDBMDATUM key, 
HDBMDATUM data)
 
 /* return any existing entry for key; otherwise call allocator to make one */
 HDBMDATUM
-hdbmentry(register HASHTABLE * tbl, HDBMDATUM key, HDBMDATUM(*allocator) ())
+hdbmentry(register HASHTABLE * tbl, HDBMDATUM key, HDBMDATUM(*allocator) 
(HDBMDATUM))
 {
     register HASHENT *hp;
     register HASHENT **nextp;
@@ -325,7 +325,8 @@ hdbmfetch(register HASHTABLE * tbl, HDBMDATUM key)
  * the same time.
  */
 void
-                hdbmwalk(HASHTABLE * tbl, register int (*nodefunc) (), 
register char *hook)
+hdbmwalk(HASHTABLE * tbl, register int (*nodefunc)
+       (HDBMDATUM, HDBMDATUM, char *), register char *hook)
  /* hook                       (void *) really */
 {
     register unsigned idx;
@@ -337,7 +338,7 @@ void
        return;
     hepp = tbl->ht_addr;
     tblsize = tbl->ht_size;
-    for (idx = 0; idx < tblsize; idx++)
+    for (idx = 0; idx < (unsigned int) tblsize; idx++)
        for (hp = hepp[idx]; hp != NULL; hp = hp->he_next)
            (*nodefunc) (hp->he_key, hp->he_data, hook);
 }
-- 
2.30.2



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.19-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to