/[gentoo-projects]/pax-utils/xfuncs.h
Gentoo

Contents of /pax-utils/xfuncs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download) (as text)
Sun Nov 4 07:26:24 2012 UTC (20 months, 3 weeks ago) by vapier
Branch: MAIN
Changes since 1.6: +4 -4 lines
File MIME type: text/x-chdr
update copyright years

1 /*
2 * Copyright 2003-2012 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v 1.6 2011/10/03 16:19:18 vapier Exp $
5 *
6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org>
8 */
9
10 #ifndef __XFUNCS_H__
11 #define __XFUNCS_H__
12
13 char *xstrdup(const char *s);
14 void *xmalloc(size_t size);
15 void *xzalloc(size_t size);
16 void *xrealloc(void *ptr, size_t size);
17 void xstrncat(char **dst, const char *src, size_t *curr_len, size_t n);
18 #define xstrcat(dst,src,curr_len) xstrncat(dst,src,curr_len,0)
19 void xchrcat(char **dst, const char append, size_t *curr_len);
20
21 void *xmemdup(const void *src, size_t n);
22
23 typedef struct {
24 void **eles;
25 size_t num;
26 } array_t;
27 void xarraypush(array_t *array, const void *ele, size_t ele_len);
28 #define xarraypush_str(arr, ele) xarraypush(arr, ele, strlen(ele) + 1 /*NUL*/)
29 void xarrayfree(array_t *array);
30 #define xrealloc_array(ptr, size, ele_size) xrealloc(ptr, (size) * (ele_size))
31 #define array_for_each(arr, n, ele) \
32 for (n = 0, ele = arr->eles[n]; n < arr->num; ++n, ele = arr->eles[n])
33 #define array_init_decl { .eles = NULL, .num = 0, }
34 #define array_cnt(arr) (arr)->num
35 char *array_flatten_str(array_t *array);
36
37 #endif

  ViewVC Help
Powered by ViewVC 1.1.20