From 5d41cec800dc6100b8181b95a08f7803dac6eeb9 Mon Sep 17 00:00:00 2001 From: "Chris Hall (GMCH)" Date: Tue, 24 Nov 2009 19:54:30 +0000 Subject: Upgrade lib/vector.c & .h This upgrade maintains the existing vector operations, but changes the underlying mechanisms. It then adds a number of new functions, extending the operations on vectors. The "struct vector" is redefined, which affects only some code in lib/command.c -- which pokes around inside what should be treated as a private data structure. Pro tem this is supported by a macro. The constant VECTOR_MIN_SIZE has been removed -- if there is a minimum size that should be enforced by the vector code. New functions include: vector_insert_item -- insert item, moving existing items vector_move_item -- move item from place to place in vector vector_delete_item -- delete item and close up gap vector_reverse -- reverse order of vector vector_push_item -- simple push vector_pop_item -- simple pop vector_insert -- insert 1 or more NULL items, moving existing items vector_delete -- delete 1 or more items and close up gap vector_bsearch -- perform binary search on vector vector_sort -- qsort vector vector_copy_here -- make copy of body of vector vector_move_here -- move body of vector vector_copy_append -- append copy of vector to end of another vector_move_append -- move body of vector to the end of another vector_copy_extract -- copy part of one vector to another vector_move_extract -- move part of one vector to another vector_copy_splice -- copy part of one vector to replace part of another, taking a copy of the replaced part vector_move_splice -- move part of one vector to replace part of another, taking a copy of the replaced part vector_copy_replace -- copy part of one vector to replace part of another vector_move_replace -- move part of one vector to replace part of another vector_discard -- discard body of vector vector_chop -- discard any unused memory in body of vector vector_decant -- decant vector to new body Other files affected: command.c: -- removal of VECTOR_MIN_SIZE -- use of vector_sort() -- use of VECTOR_INDEX to poke around inside vector (removing this is TODO) memtypes.c & memory.c -- updating names and comments for vectors vty.c -- removal of VECTOR_MIN_SIZE memory.h -- added SIZE(t,n) macro -- (sizeof(t) * (n)) --- lib/memtypes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/memtypes.c') diff --git a/lib/memtypes.c b/lib/memtypes.c index 05d93225..e7269206 100644 --- a/lib/memtypes.c +++ b/lib/memtypes.c @@ -1,6 +1,6 @@ /* * Memory type definitions. This file is parsed by memtypes.awk to extract - * MTYPE_ and memory_list_.. information in order to autogenerate + * MTYPE_ and memory_list_.. information in order to autogenerate * memtypes.h. * * The script is sensitive to the format (though not whitespace), see @@ -16,8 +16,8 @@ struct memory_list memory_list_lib[] = { { MTYPE_TMP, "Temporary memory" }, { MTYPE_STRVEC, "String vector" }, - { MTYPE_VECTOR, "Vector" }, - { MTYPE_VECTOR_INDEX, "Vector index" }, + { MTYPE_VECTOR, "Vector structure" }, + { MTYPE_VECTOR_BODY, "Vector body" }, { MTYPE_LINK_LIST, "Link List" }, { MTYPE_LINK_NODE, "Link Node" }, { MTYPE_THREAD, "Thread" }, @@ -75,7 +75,7 @@ struct memory_list memory_list_lib[] = { -1, NULL }, }; -struct memory_list memory_list_zebra[] = +struct memory_list memory_list_zebra[] = { { MTYPE_RTADV_PREFIX, "Router Advertisement Prefix" }, { MTYPE_VRF, "VRF" }, -- cgit v1.2.3