diff options
author | Pavel Machek <pavel@ucw.cz> | 2000-05-10 06:54:40 +0000 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 2000-05-10 06:54:40 +0000 |
commit | c0100454cf37833d23fdb9d24412de659f683c12 (patch) | |
tree | a1e632070155a9660885f0a9a3eff0e1ec5eacfd /nest | |
parent | fe95ab68164f0c9f18e65f7965ac4d93b24bef97 (diff) |
Added more convient interface for ea_find.
What is special about int default;? Compiler chokes on that!
Diffstat (limited to 'nest')
-rw-r--r-- | nest/route.h | 1 | ||||
-rw-r--r-- | nest/rt-attr.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/nest/route.h b/nest/route.h index d15ffae6..523d3905 100644 --- a/nest/route.h +++ b/nest/route.h @@ -324,6 +324,7 @@ typedef struct ea_list { #define EALF_CACHED 4 /* Attributes belonging to cached rta */ eattr *ea_find(ea_list *, unsigned ea); +int ea_get_int(ea_list *, unsigned ea, int def); void ea_dump(ea_list *); void ea_sort(ea_list *); /* Sort entries in all sub-lists */ unsigned ea_scan(ea_list *); /* How many bytes do we need for merged ea_list */ diff --git a/nest/rt-attr.c b/nest/rt-attr.c index d2e5ae91..53e85a6a 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -70,6 +70,15 @@ ea_find(ea_list *e, unsigned id) return a; } +int +ea_get_int(ea_list *e, unsigned id, int def) +{ + eattr *a = ea_find(e, id); + if (!a) + return def; + return a->u.data; +} + static inline void ea_do_sort(ea_list *e) { |