]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - nest/rt-attr.c
Doc: Remove some superfluous slashes
[thirdparty/bird.git] / nest / rt-attr.c
index 42b74f3467d753a2ca1c0d1b7bcce75454b7ca9f..edf27d4457e30d4d1efd9da02d1f9feee12f74bb 100644 (file)
@@ -103,7 +103,7 @@ static inline int u32_cto(uint x) { return ffs(~x) - 1; }
 static inline u32
 rte_src_alloc_id(void)
 {
-  int i, j;
+  uint i, j;
   for (i = src_id_pos; i < src_id_size; i++)
     if (src_ids[i] != 0xffffffff)
       goto found;
@@ -302,6 +302,34 @@ mpnh_merge(struct mpnh *x, struct mpnh *y, int rx, int ry, int max, linpool *lp)
   return root;
 }
 
+void
+mpnh_insert(struct mpnh **n, struct mpnh *x)
+{
+  for (; *n; n = &((*n)->next))
+  {
+    int cmp = mpnh_compare_node(*n, x);
+
+    if (cmp < 0)
+      continue;
+    else if (cmp > 0)
+      break;
+    else
+      return;
+  }
+
+  x->next = *n;
+  *n = x;
+}
+
+int
+mpnh_is_sorted(struct mpnh *x)
+{
+  for (; x && x->next; x = x->next)
+    if (mpnh_compare_node(x, x->next) >= 0)
+      return 0;
+
+  return 1;
+}
 
 static struct mpnh *
 mpnh_copy(struct mpnh *o)
@@ -757,7 +785,7 @@ static inline void
 opaque_format(struct adata *ad, byte *buf, uint size)
 {
   byte *bound = buf + size - 10;
-  int i;
+  uint i;
 
   for(i = 0; i < ad->length; i++)
     {
@@ -800,6 +828,18 @@ ea_show_ec_set(struct cli *c, struct adata *ad, byte *pos, byte *buf, byte *end)
     }
 }
 
+static inline void
+ea_show_lc_set(struct cli *c, struct adata *ad, byte *pos, byte *buf, byte *end)
+{
+  int i = lc_set_format(ad, 0, pos, end - pos);
+  cli_printf(c, -1012, "\t%s", buf);
+  while (i)
+    {
+      i = lc_set_format(ad, i, buf, end - buf - 1);
+      cli_printf(c, -1012, "\t\t%s", buf);
+    }
+}
+
 /**
  * ea_show - print an &eattr to CLI
  * @c: destination CLI
@@ -864,6 +904,9 @@ ea_show(struct cli *c, eattr *e)
        case EAF_TYPE_EC_SET:
          ea_show_ec_set(c, ad, pos, buf, end);
          return;
+       case EAF_TYPE_LC_SET:
+         ea_show_lc_set(c, ad, pos, buf, end);
+         return;
        case EAF_TYPE_UNDEF:
        default:
          bsprintf(pos, "<type %02x>", e->type);