]>
git.ipfire.org Git - thirdparty/chrony.git/blob - array.h
2 chronyd/chronyc - Programs for keeping computer clocks accurate.
4 **********************************************************************
5 * Copyright (C) Miroslav Lichvar 2014
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.
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.
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.
20 **********************************************************************
22 =======================================================================
24 Header file for array functions.
30 typedef struct ARR_Instance_Record
*ARR_Instance
;
32 /* Create a new array with given element size */
33 extern ARR_Instance
ARR_CreateInstance(unsigned int elem_size
);
35 /* Destroy the array */
36 extern void ARR_DestroyInstance(ARR_Instance array
);
38 /* Return pointer to a new element added to the end of the array */
39 extern void *ARR_GetNewElement(ARR_Instance array
);
41 /* Return element with given index */
42 extern void *ARR_GetElement(ARR_Instance array
, unsigned int index
);
44 /* Return pointer to the internal array of elements */
45 extern void *ARR_GetElements(ARR_Instance array
);
47 /* Add a new element to the end of the array */
48 extern void ARR_AppendElement(ARR_Instance array
, void *element
);
50 /* Set the size of the array */
51 extern void ARR_SetSize(ARR_Instance array
, unsigned int size
);
53 /* Return current size of the array */
54 extern unsigned int ARR_GetSize(ARR_Instance array
);