summaryrefslogtreecommitdiffstats
path: root/nest/a-set.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-04-17 13:49:41 +0200
committerMartin Mares <mj@ucw.cz>2000-04-17 13:49:41 +0200
commit700bbe60fb941534937ad11ca71968224889fa87 (patch)
treec55469e2a7ca9bf4760d4a33d7904baf2df975b4 /nest/a-set.c
parent2bd2de0188f6a0c1c9482cfc15e35c2b1b81c81a (diff)
downloadbird-700bbe60fb941534937ad11ca71968224889fa87.tar
bird-700bbe60fb941534937ad11ca71968224889fa87.zip
The previous fix for spacing was (a) totally out of context, (b) wrong.
Please *read* the code when trying to change it. Also killed a couple of type clashes.
Diffstat (limited to 'nest/a-set.c')
-rw-r--r--nest/a-set.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/nest/a-set.c b/nest/a-set.c
index fe5598e..4440714 100644
--- a/nest/a-set.c
+++ b/nest/a-set.c
@@ -23,19 +23,16 @@ int_set_format(struct adata *set, byte *buf, unsigned int size)
while (l--)
{
- if (sp)
- {
- sp = 0;
- *buf++ = ' ';
- }
+ if (!sp)
+ *buf++ = ' ';
if (buf > end)
{
strcpy(buf, "...");
return;
}
- /* FIXME: should not we use same syntax as in filters (i.e. (x,y) )? */
- buf += bsprintf(buf, "%d:%d ", *z/65536, *z & 0xffff);
+ buf += bsprintf(buf, "(%d,%d)", *z >> 16, *z & 0xffff);
z++;
+ sp = 0;
}
*buf = 0;
}
@@ -53,8 +50,8 @@ int_set_add(struct linpool *pool, struct adata *list, u32 val)
int
int_set_contains(struct adata *list, u32 val)
{
- u32 *l = &(list->data);
- int i;
+ u32 *l = (u32 *) list->data;
+ unsigned int i;
for (i=0; i<list->length/4; i++)
if (*l++ == val)
return 1;
@@ -66,7 +63,7 @@ int_set_del(struct linpool *pool, struct adata *list, u32 val)
{
struct adata *res;
u32 *l, *k;
- int i;
+ unsigned int i;
if (!int_set_contains(list, val))
return list;
@@ -74,8 +71,8 @@ int_set_del(struct linpool *pool, struct adata *list, u32 val)
res = lp_alloc(pool, list->length + sizeof(struct adata) - 4);
res->length = list->length-4;
- l = &(list->data);
- k = &(res->data);
+ l = (u32 *) list->data;
+ k = (u32 *) res->data;
for (i=0; i<list->length/4; i++)
if (l[i] != val)
*k++ = l[i];