mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
ALIGN -> BIRD_ALIGN
This commit is contained in:
parent
22122d4d4c
commit
7fdd338c36
@ -13,9 +13,7 @@
|
|||||||
|
|
||||||
#define OFFSETOF(s, i) ((unsigned int)&((s *)0)->i)
|
#define OFFSETOF(s, i) ((unsigned int)&((s *)0)->i)
|
||||||
#define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i)))
|
#define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i)))
|
||||||
#ifndef ALIGN
|
#define BIRD_ALIGN(s, a) (((s)+a-1)&~(a-1))
|
||||||
#define ALIGN(s, a) (((s)+a-1)&~(a-1))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Utility macros */
|
/* Utility macros */
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ linpool
|
|||||||
void *
|
void *
|
||||||
lp_alloc(linpool *m, unsigned size)
|
lp_alloc(linpool *m, unsigned size)
|
||||||
{
|
{
|
||||||
byte *a = (byte *) ALIGN((unsigned long) m->ptr, CPU_STRUCT_ALIGN);
|
byte *a = (byte *) BIRD_ALIGN((unsigned long) m->ptr, CPU_STRUCT_ALIGN);
|
||||||
byte *e = a + size;
|
byte *e = a + size;
|
||||||
|
|
||||||
if (e <= m->end)
|
if (e <= m->end)
|
||||||
|
@ -327,7 +327,7 @@ bgp_new_bucket(struct bgp_proto *p, ea_list *new, unsigned hash)
|
|||||||
{
|
{
|
||||||
struct bgp_bucket *b;
|
struct bgp_bucket *b;
|
||||||
unsigned ea_size = sizeof(ea_list) + new->count * sizeof(eattr);
|
unsigned ea_size = sizeof(ea_list) + new->count * sizeof(eattr);
|
||||||
unsigned ea_size_aligned = ALIGN(ea_size, CPU_STRUCT_ALIGN);
|
unsigned ea_size_aligned = BIRD_ALIGN(ea_size, CPU_STRUCT_ALIGN);
|
||||||
unsigned size = sizeof(struct bgp_bucket) + ea_size;
|
unsigned size = sizeof(struct bgp_bucket) + ea_size;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
byte *dest;
|
byte *dest;
|
||||||
@ -338,7 +338,7 @@ bgp_new_bucket(struct bgp_proto *p, ea_list *new, unsigned hash)
|
|||||||
{
|
{
|
||||||
eattr *a = &new->attrs[i];
|
eattr *a = &new->attrs[i];
|
||||||
if (!(a->type & EAF_EMBEDDED))
|
if (!(a->type & EAF_EMBEDDED))
|
||||||
size += ALIGN(sizeof(struct adata) + a->u.ptr->length, CPU_STRUCT_ALIGN);
|
size += BIRD_ALIGN(sizeof(struct adata) + a->u.ptr->length, CPU_STRUCT_ALIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the bucket and hash it */
|
/* Create the bucket and hash it */
|
||||||
@ -364,7 +364,7 @@ bgp_new_bucket(struct bgp_proto *p, ea_list *new, unsigned hash)
|
|||||||
struct adata *na = (struct adata *) dest;
|
struct adata *na = (struct adata *) dest;
|
||||||
memcpy(na, oa, sizeof(struct adata) + oa->length);
|
memcpy(na, oa, sizeof(struct adata) + oa->length);
|
||||||
a->u.ptr = na;
|
a->u.ptr = na;
|
||||||
dest += ALIGN(sizeof(struct adata) + na->length, CPU_STRUCT_ALIGN);
|
dest += BIRD_ALIGN(sizeof(struct adata) + na->length, CPU_STRUCT_ALIGN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user