Blame array.h

Packit 96c956
/*
Packit 96c956
  chronyd/chronyc - Programs for keeping computer clocks accurate.
Packit 96c956
Packit 96c956
 **********************************************************************
Packit 96c956
 * Copyright (C) Miroslav Lichvar  2014
Packit 96c956
 * 
Packit 96c956
 * This program is free software; you can redistribute it and/or modify
Packit 96c956
 * it under the terms of version 2 of the GNU General Public License as
Packit 96c956
 * published by the Free Software Foundation.
Packit 96c956
 * 
Packit 96c956
 * This program is distributed in the hope that it will be useful, but
Packit 96c956
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 96c956
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 96c956
 * General Public License for more details.
Packit 96c956
 * 
Packit 96c956
 * You should have received a copy of the GNU General Public License along
Packit 96c956
 * with this program; if not, write to the Free Software Foundation, Inc.,
Packit 96c956
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
Packit 96c956
 * 
Packit 96c956
 **********************************************************************
Packit 96c956
Packit 96c956
  =======================================================================
Packit 96c956
Packit 96c956
  Header file for array functions.
Packit 96c956
  */
Packit 96c956
Packit 96c956
#ifndef GOT_ARRAY_H
Packit 96c956
#define GOT_ARRAY_H
Packit 96c956
Packit 96c956
typedef struct ARR_Instance_Record *ARR_Instance;
Packit 96c956
Packit 96c956
/* Create a new array with given element size */
Packit 96c956
extern ARR_Instance ARR_CreateInstance(unsigned int elem_size);
Packit 96c956
Packit 96c956
/* Destroy the array */
Packit 96c956
extern void ARR_DestroyInstance(ARR_Instance array);
Packit 96c956
Packit 96c956
/* Return pointer to a new element added to the end of the array */
Packit 96c956
extern void *ARR_GetNewElement(ARR_Instance array);
Packit 96c956
Packit 96c956
/* Return element with given index */
Packit 96c956
extern void *ARR_GetElement(ARR_Instance array, unsigned int index);
Packit 96c956
Packit 96c956
/* Return pointer to the internal array of elements */
Packit 96c956
extern void *ARR_GetElements(ARR_Instance array);
Packit 96c956
Packit 96c956
/* Add a new element to the end of the array */
Packit 96c956
extern void ARR_AppendElement(ARR_Instance array, void *element);
Packit 96c956
Packit 96c956
/* Set the size of the array */
Packit 96c956
extern void ARR_SetSize(ARR_Instance array, unsigned int size);
Packit 96c956
Packit 96c956
/* Return current size of the array */
Packit 96c956
extern unsigned int ARR_GetSize(ARR_Instance array);
Packit 96c956
Packit 96c956
#endif