File: array.h

package info (click to toggle)
medussa 0.8-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,004 kB
  • ctags: 1,156
  • sloc: ansic: 9,049; sh: 3,319; makefile: 113
file content (48 lines) | stat: -rw-r--r-- 1,390 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * medussa - a distributed cracking system
 * Copyright (C) 1999 Kostas Evangelinos <kos@bastard.net>
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * 
 */
/*
 * simple expandable array
 * $Id: array.h,v 1.4 1999/12/20 19:51:27 kos Exp $
 */

#ifndef _ARRAY_H
#define _ARRAY_H

#define ARRAY_CHUNK 128

typedef struct array {
  void *data;
  int allocelem;
  int nelem;
  int sizelem;
} array;

/* Exported */
array *array_init_hint(array *, int sizelem, int hint);
array *array_init(int sizelem);
int array_add(array *, void *data);
#define array_nelems(x) (x ? (x)->nelem : 0)
int array_nuke(array *);
void * array_get(array *, int which );
int array_zero(array *);
int array_delete(array *, int which);

#endif