From 366c683ff12d823f8c58bd3c706aa7873896863a Mon Sep 17 00:00:00 2001 From: Michael Hahsler Date: Fri, 19 Nov 2021 06:55:01 -0600 Subject: [PATCH] Fixed some C issues. --- DESCRIPTION | 4 ++-- NEWS.md | 6 ++++++ src/bitmat.c | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ce5bdc2..4f4e071 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: arules -Version: 1.7-0 -Date: 2021-11-12 +Version: 1.7-1 +Date: 2021-11-18 Title: Mining Association Rules and Frequent Itemsets Authors@R: c(person("Michael", "Hahsler", role = c("aut", "cre", "cph"), email = "mhahsler@lyle.smu.edu"), diff --git a/NEWS.md b/NEWS.md index fe2c19d..d9d310f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# arules 1.7-1 (11/18/2021) + +## Bugfixes + +* Fixed some C issues: unsigned int in bitmat.c (function static int _exists) to ensure bit shifting works. The bitmap support buffer is now initialized with zeros. + # arules 1.7-0 (11/12/2021) ## New Feature diff --git a/src/bitmat.c b/src/bitmat.c index eafe2a5..26c32ec 100644 --- a/src/bitmat.c +++ b/src/bitmat.c @@ -326,7 +326,8 @@ int bm_count (BITMAT *bm, int row) static int _exists (BITMAT *bm, int *ids, int n, int supp) { /* -- check maximal/closed item sets */ int i, k, x, m = n; /* loop variables */ - int b, bb; /* support bit mask */ + // MFH: int b, bb; /* support bit mask */ + unsigned int b, bb; /* support bit mask */ int *d, *s; /* to traverse the bit vectors */ int r = 0; /* result of intersection */ @@ -477,7 +478,9 @@ static int _buffers (BITMAT *bm, int mode) bm->buf = (int*)malloc((BLKSIZE+1) *sizeof(int)) +1; if (!bm->buf) { bm_delete(bm); return -1; } if (mode != BM_CLOSED) return 0; - bm->supps = (int*)malloc((BLKSIZE << BM_SHIFT) *sizeof(int)); + // MFH: Initialize with 0 + //bm->supps = (int*)malloc((BLKSIZE << BM_SHIFT) *sizeof(int)); + bm->supps = (int*)calloc((BLKSIZE << BM_SHIFT), sizeof(int)); if (!bm->supps) { bm_delete(bm); return -1; } return 0; /* allocate additional buffers */ } /* _buffers() */