/[baselayout]/trunk/src/rc-misc.h
Gentoo

Diff of /trunk/src/rc-misc.h

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

Revision 2995 Revision 2996
39#define RC_LINEBUFFER 4096 39#define RC_LINEBUFFER 4096
40 40
41/* Good defaults just incase user has none set */ 41/* Good defaults just incase user has none set */
42#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" 42#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
43 43
44#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
45
46static inline void *rc_xmalloc (size_t size)
47{
48 void *value = malloc (size);
49
50 if (value)
51 return (value);
52
53 ERRX;
54}
55
56static inline void *rc_xrealloc (void *ptr, size_t size)
57{
58 void *value = realloc (ptr, size);
59
60 if (value)
61 return (value);
62
63 ERRX;
64}
65
66static inline char *rc_xstrdup (const char *str)
67{
68 char *value;
69
70 if (! str)
71 return (NULL);
72
73 value = strdup (str);
74
75 if (value)
76 return (value);
77
78 ERRX;
79}
80
81#undef ERRX
82
44static inline bool rc_exists (const char *pathname) 83static inline bool rc_exists (const char *pathname)
45{ 84{
46 struct stat buf; 85 struct stat buf;
47 int serrno = errno; 86 int serrno = errno;
48 87

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

  ViewVC Help
Powered by ViewVC 1.1.20