1 /*
2   chronyd/chronyc - Programs for keeping computer clocks accurate.
3 
4  **********************************************************************
5  * Copyright (C) Miroslav Lichvar  2014
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of version 2 of the GNU General Public License as
9  * published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  *
20  **********************************************************************
21 
22   =======================================================================
23 
24   Header file for array functions.
25   */
26 
27 #ifndef GOT_ARRAY_H
28 #define GOT_ARRAY_H
29 
30 typedef struct ARR_Instance_Record *ARR_Instance;
31 
32 /* Create a new array with given element size */
33 extern ARR_Instance ARR_CreateInstance(unsigned int elem_size);
34 
35 /* Destroy the array */
36 extern void ARR_DestroyInstance(ARR_Instance array);
37 
38 /* Return pointer to a new element added to the end of the array */
39 extern void *ARR_GetNewElement(ARR_Instance array);
40 
41 /* Return element with given index */
42 extern void *ARR_GetElement(ARR_Instance array, unsigned int index);
43 
44 /* Return pointer to the internal array of elements */
45 extern void *ARR_GetElements(ARR_Instance array);
46 
47 /* Add a new element to the end of the array */
48 extern void ARR_AppendElement(ARR_Instance array, void *element);
49 
50 /* Set the size of the array */
51 extern void ARR_SetSize(ARR_Instance array, unsigned int size);
52 
53 /* Return current size of the array */
54 extern unsigned int ARR_GetSize(ARR_Instance array);
55 
56 #endif
57