[PATCH 03/12] Introduce and use val_same() to decide if values are same or not

Ondrej Zajicek santiago at crfreenet.org
Thu Oct 3 13:15:49 CEST 2013

On Mon, Sep 30, 2013 at 09:27:24PM +0300, Sergey Popovich wrote:
> val_same() compares passed @v1 and @v2 and returns 1 if they are
> same, 0 if not and 999 in case their types not comparable.
> Change pm_path_compare() to return 1 - if @m1 and @m2 are the same and
> 0 overwise. Rename pm_path_compare() to pm_path_same() according to its
> return values. Use it in val_same() to compare path masks.

Thanks, applied.

Although with minor changes - val_same() is now supposed to work
on all possible values as inputs, so it does not return
CMP_ERROR (different types would return 0).

> @@ -1478,31 +1505,8 @@ i_same(struct f_inst *f1, struct f_inst *f2)
>      }
>      break;
>    case 'C': -    {
> +    if (!val_same(* (struct f_val *) f1->a1.p, * (struct f_val *)
> f2->a1.p))
> +      return 0;

BTW, with your val_same() this code had a bug - CMP_ERROR from different
types get converted to same.

Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20131003/dbe811a0/attachment.asc>

More information about the Bird-users mailing list