Skip to content

Commit

Permalink
Fixed some C issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhahsler committed Nov 19, 2021
1 parent 2eeb857 commit 366c683
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/bitmat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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() */
Expand Down

0 comments on commit 366c683

Please sign in to comment.