diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2021-10-20 18:52:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-20 18:52:00 -0400 |
| commit | 3c8161eaa88f6ae181637b8ad7d3a39399470cee (patch) | |
| tree | 35c0e6579728f81b8f1c2154549a39454b564183 /lib/vector.h | |
| parent | 61a7ec774caff0b07134a76e82641af9a39a3fb6 (diff) | |
| parent | 14c39974bbb37a1c95800b75af3d25ff72295f41 (diff) | |
Merge pull request #9843 from opensourcerouting/vtysh-startup-cost
vtysh: improve startup time by ca. ×6
Diffstat (limited to 'lib/vector.h')
| -rw-r--r-- | lib/vector.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/vector.h b/lib/vector.h index 845c8d8b04..6208be1cc7 100644 --- a/lib/vector.h +++ b/lib/vector.h @@ -32,6 +32,7 @@ extern "C" { struct _vector { unsigned int active; /* number of active slots */ unsigned int alloced; /* number of allocated slot */ + unsigned int count; void **index; /* index to data */ }; typedef struct _vector *vector; @@ -60,7 +61,11 @@ extern void vector_unset_value(vector v, void *val); extern void vector_remove(vector v, unsigned int ix); extern void vector_compact(vector v); -extern unsigned int vector_count(vector v); +static inline unsigned int vector_count(vector v) +{ + return v->count; +} + extern void vector_free(vector v); extern vector vector_copy(vector v); |
