Looks good... I tried not play with the original rblcheck as much as
possible. Thanks for the tips, I'll roll them in when I get a chance.
My plan is to rewrite the whole mess to make it a bit more
coherent (not that rblcheck wasn't, but the combo of my code and his
isn't the cleanest, and there's extra stuff in there that doesn't need
to be).
jon
On Mon, Nov 06, 2000 at 03:25:33PM +0000, Tullio Andreatta wrote:
> >I'm not an experienced C programmer, so feedback is welcome and
> >encouraged.
>
> Using dynamic allocated memory to store static data is not so good.
> Since we know RBL domains at compile time, how about ...
>
> struct rbl {
> char *site;
> unsigned int rating;
> } rblsites[] = {
> { "rbl.maps.vix.com", 16},
> { "dul.maps.vix.com", 8},
> { "relays.mail-abuse.org", 4},
> { "outputs.orbs.org", 2},
> { "relays.orbs.org", 1},
> { NULL, 0 }
> };
>
> struct rbl *ptr;
>
> ... and ...
>
> rblfiltered = 0;
> for (ptr = rblsites; ptr->site != NULL; ptr++)
> {
> if (max_rating >= ptr->rating)
> {
> response = rblcheck(a, ptr->site, txt);
> if (response)
> rbfiltered += ptr->rating;
> }
> }
>
> return rbfiltered;
> }
>
> ... ?