array.h 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * This file is part of libbluray
 * Copyright (C) 2014  Petri Hintukainen <phintuka@users.sourceforge.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see
 * <http://www.gnu.org/licenses/>.
 */

#ifndef BD_ARRAY_H_
#define BD_ARRAY_H_

#include "attributes.h"

25
#include <stddef.h>
26 27 28 29 30 31 32 33 34 35 36 37

/*
 * array_alloc()
 *
 * Allocate an array of objects.
 * Each object is initialized with zeros.
 *
 * @param  n   number of objects
 * @param  sz  size of single object
 * @return     array of n pointers, each pointing to memory block of size sz.
 *
 */
hpi1's avatar
hpi1 committed
38
BD_PRIVATE void *array_alloc(size_t n, size_t sz) BD_ATTR_MALLOC;
39 40 41 42 43 44 45 46 47 48 49

/*
 * array_free()
 *
 * Free array allocated with array_alloc().
 *
 * @param p  pointer to pointer allocated with bd_array_alloc()
 */
BD_PRIVATE void array_free(void **p);

#endif // BD_ARRAY_H_