From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 19 Sep 2005 19:03:26 +0400 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20050919150326.GD3260@solemn.turbinal.org> Mail-Followup-To: ALT Devel discussion list References: <20050917222328.GD2358@solemn.turbinal.org> <20050917223243.GA24449@basalt.office.altlinux.org> <20050917230044.GE2358@solemn.turbinal.org> <20050917232346.GB24652@basalt.office.altlinux.org> <20050918084618.GH2358@solemn.turbinal.org> <20050918100251.GI2358@solemn.turbinal.org> <20050918201834.GL2358@solemn.turbinal.org> <20050919064708.GA7249@mycomp.mydomain> <432E668E.7090307@altlinux.org> <432ECEAA.2050302@altlinux.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ylS2wUBXLOxYXZFQ" Content-Disposition: inline In-Reply-To: <432ECEAA.2050302@altlinux.ru> Subject: [devel] Re: bloom filters X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 15:04:22 -0000 Archived-At: List-Archive: List-Post: --ylS2wUBXLOxYXZFQ Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 19, 2005 at 11:43:54PM +0900, Ivan Fedorov wrote: > =F0=D2=CF=C7=D2=C1=CD=CD=D9 =C9=CD=C5=C0=D4 =D3=D7=CF=CA=D3=D4=D7=CF =D4= =CF=CC=D3=D4=C5=D4=D8 =D3=CF =D7=D2=C5=CD=C5=CE=C5=CD, =D4=C1=CB =DE=D4=CF = IMHO =CC=D5=DE=DB=C5 =D3=D2=C1=DA=D5 > =D4=C1=CB=CF=C5 =D7=D9=D2=C5=DA=C1=D4=D8 =CE=C1 =CB=CF=D2=CE=C0. =FA=C4=C5=D3=D8 =CE=C5=CD=CE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E=D1=D4=D8 = =D3=C5=C2=C5 =D6=C9=DA=CE=D8 =D7 =C2=D5=C4=D5=DD=C5=CD - =C5=D3=CC=C9 =C4= =C5=CC=C1=C5=DB=D8, =D4=CF =C4=C5=CC=C1=CA > =CB=C1=CB =CE=C1=C4=CF, =C1 =CE=C5 =CB=C1=CB =D0=CF=CC=D5=DE=C9=D4=D3=D1! =EF=C8... okay. --- bloom.c- 2005-09-18 19:06:33 +0000 +++ bloom.c 2005-09-19 14:44:50 +0000 @@ -109,6 +123,7 @@ int main(int argc, char *argv[]) size_t n =3D 1024; double p =3D 0.01; char *e =3D NULL; + BF *bf =3D NULL; int c; while ((c =3D getopt(argc, argv, "n:p:e:")) !=3D -1) { switch (c) { @@ -133,14 +148,14 @@ int main(int argc, char *argv[]) int exists; FILE *fp =3D fopen(argv[optind], "r"); assert(fp); - BF *bf =3D BF_load(fp); + bf =3D BF_load(fp); exists =3D BF_exists(bf, e, strlen(e)); exit(!exists); } else { char line[1024]; - BF *bf =3D BF_new(n, p); FILE *fp =3D fopen(argv[optind], "r"); assert(fp); + bf =3D BF_new(n, p); while (fgets(line, sizeof(line), fp)) { int len =3D strlen(line); if (line[len - 1] =3D=3D '\n') @@ -149,5 +164,81 @@ int main(int argc, char *argv[]) } BF_save(bf, stdout); } + free(bf); return 0; } --ylS2wUBXLOxYXZFQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFDLtM+fBKgtDjnu0YRAjCXAKDkG5xORQxQwS2IxHznDZh9B37/zACeM4nX bX7+EXQDnkUQ17C6cuj7mXY= =0Yyj -----END PGP SIGNATURE----- --ylS2wUBXLOxYXZFQ--