2 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <vppinfra/pool.h>
19 /* can be a very large size */
23 main (int argc, char *argv[])
30 clib_mem_init (0, 3ULL << 30);
32 vec_validate (indices, NELTS - 1);
33 vec_set_len (indices, 0);
35 pool_init_fixed (tp, NELTS);
37 for (i = 0; i < NELTS; i++)
40 vec_add1 (indices, junk - tp);
44 for (i = 0; i < NELTS; i++)
46 junk = pool_elt_at_index (tp, indices[i]);
50 fformat (stdout, "%d pool elts before deletes\n", pool_elts (tp));
52 pool_put_index (tp, indices[12]);
53 pool_put_index (tp, indices[43]);
55 fformat (stdout, "%d pool elts after deletes\n", pool_elts (tp));
64 * fd.io coding-style-patch-verification: ON
67 * eval: (c-set-style "gnu")