/[baselayout]/trunk/src/librc-misc.c
Gentoo

Diff of /trunk/src/librc-misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2995 Revision 2996
4 Copyright 2007 Gentoo Foundation 4 Copyright 2007 Gentoo Foundation
5 */ 5 */
6 6
7#include "librc.h" 7#include "librc.h"
8 8
9#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
10 9
11#define PROFILE_ENV "/etc/profile.env" 10#define PROFILE_ENV "/etc/profile.env"
12#define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist" 11#define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist"
13#define USR_WHITELIST "/etc/conf.d/env_whitelist" 12#define USR_WHITELIST "/etc/conf.d/env_whitelist"
14#define RC_CONFIG "/etc/conf.d/rc" 13#define RC_CONFIG "/etc/conf.d/rc"
15 14
16#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" 15#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
17 16
18void *rc_xmalloc (size_t size)
19{
20 void *value = malloc (size);
21
22 if (value)
23 return (value);
24
25 ERRX;
26}
27librc_hidden_def(rc_xmalloc)
28
29void *rc_xrealloc (void *ptr, size_t size)
30{
31 void *value = realloc (ptr, size);
32
33 if (value)
34 return (value);
35
36 ERRX;
37}
38librc_hidden_def(rc_xrealloc)
39
40char *rc_xstrdup (const char *str)
41{
42 char *value;
43
44 if (! str)
45 return (NULL);
46
47 value = strdup (str);
48
49 if (value)
50 return (value);
51
52 ERRX;
53}
54librc_hidden_def(rc_xstrdup)
55 17
56bool rc_env_bool (const char *var) 18bool rc_env_bool (const char *var)
57{ 19{
58 char *v; 20 char *v;
59 21

Legend:
Removed from v.2995  
changed lines
  Added in v.2996

  ViewVC Help
Powered by ViewVC 1.1.20