blob: 78e899c6e355f9f75c843a16954d38ad01017b20 (
plain)
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
|
#ifndef COMMON_H
#define COMMON_H
#include <stdio.h>
#ifdef DEBUG
void debugp (char *filename, const char *str, ...);
void hexdump (char *filename, unsigned char *data, unsigned int amount);
#endif
/* exactly the same semantics like their non-x functions, but asserting a
* successful non-NULL return.
*/
void * xrealloc (void *m_ptr, size_t newsize);
char * xstrdup (char *str);
void * xcalloc (int factor, size_t size);
/* array_compaction
*
* compact an array of pointers by removing all NULL pointers from it. the
* array of pointers is at `arr_ptr' and holds `el_count' elements.
*
* return number of real elements in array after compaction
*/
unsigned int
array_compaction (void *arr_ptr, unsigned int el_count);
#endif
|