RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 15-Nov-2009 17:30:14 Branch: HEAD Handle: 2009111516301201 Modified files: rpm CHANGES rpm/rpmio rpmbf.c rpmbf.h Log: - rpmbf: permit non-string Bloom filters, s/char/void/ in prototypes. Summary: Revision Changes Path 1.3158 +1 -0 rpm/CHANGES 2.6 +12 -9 rpm/rpmio/rpmbf.c 2.5 +13 -13 rpm/rpmio/rpmbf.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3157 -r1.3158 CHANGES --- rpm/CHANGES 14 Nov 2009 16:22:48 -0000 1.3157 +++ rpm/CHANGES 15 Nov 2009 16:30:12 -0000 1.3158 @@ -1,5 +1,6 @@ 5.2b1 -> 5.3a1 + - jbj: rpmbf: permit non-string Bloom filters, s/char/void/ in prototypes. - jbj: rpmdb: eliminate rpmdbFlags hysteria. - jbj: rpmdb: use Seqno to assign Packages primary keys. - jbj: rpmdb: save Packages primary key in network order always. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmbf.c ============================================================================ $ cvs diff -u -r2.5 -r2.6 rpmbf.c --- rpm/rpmio/rpmbf.c 2 Oct 2009 05:46:02 -0000 2.5 +++ rpm/rpmio/rpmbf.c 15 Nov 2009 16:30:13 -0000 2.6 @@ -64,8 +64,9 @@ return rpmbfLink(bf); } -int rpmbfAdd(rpmbf bf, const char * s, size_t ns) +int rpmbfAdd(rpmbf bf, const void * _s, size_t ns) { + const char * s = _s; rpmuint32_t h0 = 0; rpmuint32_t h1 = 0; @@ -79,12 +80,13 @@ } bf->n++; if (_rpmbf_debug) -fprintf(stderr, "--> %s(%p,\"%s\") bf{%u,%u}[%u]\n", __FUNCTION__, bf, s, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); +fprintf(stderr, "<-- %s(%p,\"%s\") bf{%u,%u}[%u]\n", __FUNCTION__, bf, s, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); return 0; } -int rpmbfChk(rpmbf bf, const char * s, size_t ns) +int rpmbfChk(rpmbf bf, const void * _s, size_t ns) { + const char * s = _s; rpmuint32_t h0 = 0; rpmuint32_t h1 = 0; int rc = 1; @@ -101,7 +103,7 @@ break; } if (_rpmbf_debug) -fprintf(stderr, "--> %s(%p,\"%s\") bf{%u,%u}[%u]\n", __FUNCTION__, bf, s, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); +fprintf(stderr, "<-- %s(%p,\"%s\") bf{%u,%u}[%u]\n", __FUNCTION__, bf, s, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); return rc; } @@ -113,12 +115,13 @@ memset(bits, 0, nw * nbw); bf->n = 0; if (_rpmbf_debug) -fprintf(stderr, "--> %s(%p) bf{%u,%u}[%u]\n", __FUNCTION__, bf, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); +fprintf(stderr, "<-- %s(%p) bf{%u,%u}[%u]\n", __FUNCTION__, bf, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); return 0; } -int rpmbfDel(rpmbf bf, const char * s, size_t ns) +int rpmbfDel(rpmbf bf, const void * _s, size_t ns) { + const char * s = _s; rpmuint32_t h0 = 0; rpmuint32_t h1 = 0; @@ -134,7 +137,7 @@ if (bf->n != 0) bf->n--; if (_rpmbf_debug) -fprintf(stderr, "--> %s(%p,\"%s\") bf{%u,%u}[%u]\n", __FUNCTION__, bf, s, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); +fprintf(stderr, "<-- %s(%p,\"%s\") bf{%u,%u}[%u]\n", __FUNCTION__, bf, s, (unsigned)bf->m, (unsigned)bf->k, (unsigned)bf->n); return 0; } @@ -151,7 +154,7 @@ abits[i] &= bbits[i]; a->n = 1; /* XXX what is population estimate? */ if (_rpmbf_debug) -fprintf(stderr, "--> %s(%p,%p) bf{%u,%u}[%u]\n", __FUNCTION__, a, b, (unsigned)a->m, (unsigned)a->k, (unsigned)a->n); +fprintf(stderr, "<-- %s(%p,%p) bf{%u,%u}[%u]\n", __FUNCTION__, a, b, (unsigned)a->m, (unsigned)a->k, (unsigned)a->n); return 0; } @@ -168,6 +171,6 @@ abits[i] |= bbits[i]; a->n += b->n; if (_rpmbf_debug) -fprintf(stderr, "--> %s(%p,%p) bf{%u,%u}[%u]\n", __FUNCTION__, a, b, (unsigned)a->m, (unsigned)a->k, (unsigned)a->n); +fprintf(stderr, "<-- %s(%p,%p) bf{%u,%u}[%u]\n", __FUNCTION__, a, b, (unsigned)a->m, (unsigned)a->k, (unsigned)a->n); return 0; } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmbf.h ============================================================================ $ cvs diff -u -r2.4 -r2.5 rpmbf.h --- rpm/rpmio/rpmbf.h 2 Oct 2009 05:46:02 -0000 2.4 +++ rpm/rpmio/rpmbf.h 15 Nov 2009 16:30:13 -0000 2.5 @@ -130,13 +130,13 @@ /*...@*/; /** - * Add string to a Bloom filter. + * Add item to a Bloom filter. * @param bf Bloom filter - * @param s string - * @param ns no. bytes in string (0 will do strlen) + * @param *_s bytes + * @param ns no. bytes (0 uses strlen) * @return 0 always */ -int rpmbfAdd(rpmbf bf, const char * s, size_t ns) +int rpmbfAdd(rpmbf bf, const void * _s, size_t ns) /*...@modifies bf @*/; /** @@ -148,24 +148,24 @@ /*...@modifies bf @*/; /** - * Check for string in a Bloom filter. + * Check for item in a Bloom filter. * @param bf Bloom filter - * @param s string - * @param ns no. bytes in string (0 will do strlen) + * @param *_s bytes + * @param ns no. bytes (0 uses strlen) * @return 1 if string is present, 0 if not */ -int rpmbfChk(rpmbf bf, const char * s, size_t ns) +int rpmbfChk(rpmbf bf, const void * _s, size_t ns) /*...@modifies bf @*/; /** - * Delete string from a Bloom filter. - * @todo Counting bloom filter needed. + * Delete item from a Bloom filter. + * @todo Counting bloom filter needed? * @param bf Bloom filter - * @param s string - * @param ns no. bytes in string (0 will do strlen) + * @param *_s bytes + * @param ns no. bytes (0 will do strlen) * @return 0 always */ -int rpmbfDel(rpmbf bf, const char * s, size_t ns) +int rpmbfDel(rpmbf bf, const void * _s, size_t ns) /*...@modifies bf @*/; /** @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org