Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-projects commit in pax-utils: xfuncs.c xfuncs.h
Date: Thu, 03 Dec 2009 04:15:56
Message-Id: E1NG36g-00076f-Cc@stork.gentoo.org
1 vapier 09/12/03 04:15:54
2
3 Modified: xfuncs.c xfuncs.h
4 Log:
5 dont need strndup code anymore
6
7 Revision Changes Path
8 1.7 pax-utils/xfuncs.c
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/xfuncs.c?rev=1.7&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/xfuncs.c?rev=1.7&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/xfuncs.c?r1=1.6&r2=1.7
13
14 Index: xfuncs.c
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.c,v
17 retrieving revision 1.6
18 retrieving revision 1.7
19 diff -u -r1.6 -r1.7
20 --- xfuncs.c 1 Dec 2009 10:15:06 -0000 1.6
21 +++ xfuncs.c 3 Dec 2009 04:15:54 -0000 1.7
22 @@ -1,7 +1,7 @@
23 /*
24 * Copyright 2003-2007 Gentoo Foundation
25 * Distributed under the terms of the GNU General Public License v2
26 - * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.c,v 1.6 2009/12/01 10:15:06 vapier Exp $
27 + * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.c,v 1.7 2009/12/03 04:15:54 vapier Exp $
28 *
29 * Copyright 2003-2007 Ned Ludd - <solar@g.o>
30 * Copyright 2004-2007 Mike Frysinger - <vapier@g.o>
31 @@ -16,32 +16,6 @@
32 return ret;
33 }
34
35 -#ifndef strndup
36 -static inline char *my_strndup(const char *str, size_t n)
37 -{
38 - size_t r;
39 - char *ret;
40 - for (r = 0; r < n; ++r)
41 - if (!str[r])
42 - break;
43 -
44 - ret = xmalloc(r + 1);
45 - memcpy(ret, str, r);
46 - ret[r] = '\0';
47 - return ret;
48 -}
49 -/* do this to avoid warning: declaration of 'strndup' shadows a built-in
50 - * function */
51 -#define strndup(S, N) my_strndup(S, N)
52 -#endif
53 -
54 -char *xstrndup(const char *s, const size_t n)
55 -{
56 - char *ret = strndup(s, n);
57 - if (!ret) err("Could not strndup(): %s", strerror(errno));
58 - return ret;
59 -}
60 -
61 void *xmalloc(size_t size)
62 {
63 void *ret = malloc(size);
64
65
66
67 1.4 pax-utils/xfuncs.h
68
69 file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/xfuncs.h?rev=1.4&view=markup
70 plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/xfuncs.h?rev=1.4&content-type=text/plain
71 diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/xfuncs.h?r1=1.3&r2=1.4
72
73 Index: xfuncs.h
74 ===================================================================
75 RCS file: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v
76 retrieving revision 1.3
77 retrieving revision 1.4
78 diff -u -r1.3 -r1.4
79 --- xfuncs.h 31 Jan 2009 17:58:37 -0000 1.3
80 +++ xfuncs.h 3 Dec 2009 04:15:54 -0000 1.4
81 @@ -1,7 +1,7 @@
82 /*
83 * Copyright 2003-2007 Gentoo Foundation
84 * Distributed under the terms of the GNU General Public License v2
85 - * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v 1.3 2009/01/31 17:58:37 grobian Exp $
86 + * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v 1.4 2009/12/03 04:15:54 vapier Exp $
87 *
88 * Copyright 2003-2007 Ned Ludd - <solar@g.o>
89 * Copyright 2004-2007 Mike Frysinger - <vapier@g.o>
90 @@ -11,7 +11,6 @@
91 #define __XFUNCS_H__
92
93 char *xstrdup(const char *s);
94 -char *xstrndup(const char *s, const size_t n);
95 void *xmalloc(size_t size);
96 void *xzalloc(size_t size);
97 void *xrealloc(void *ptr, size_t size);