Define our x* functions as unused rather than inline for a massive space saving.
This commit is contained in:
parent
2007ed4b95
commit
cbe5648158
@ -67,7 +67,11 @@
|
|||||||
|
|
||||||
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
|
#define ERRX fprintf (stderr, "out of memory\n"); exit (1)
|
||||||
|
|
||||||
static inline void *xmalloc (size_t size)
|
#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
|
||||||
|
# define _unused __attribute__((__unused__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_unused static void *xmalloc (size_t size)
|
||||||
{
|
{
|
||||||
void *value = malloc (size);
|
void *value = malloc (size);
|
||||||
|
|
||||||
@ -77,7 +81,7 @@ static inline void *xmalloc (size_t size)
|
|||||||
ERRX;
|
ERRX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *xrealloc (void *ptr, size_t size)
|
_unused static void *xrealloc (void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
void *value = realloc (ptr, size);
|
void *value = realloc (ptr, size);
|
||||||
|
|
||||||
@ -87,7 +91,7 @@ static inline void *xrealloc (void *ptr, size_t size)
|
|||||||
ERRX;
|
ERRX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *xstrdup (const char *str)
|
_unused static char *xstrdup (const char *str)
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
@ -104,19 +108,20 @@ static inline char *xstrdup (const char *str)
|
|||||||
|
|
||||||
#undef ERRX
|
#undef ERRX
|
||||||
|
|
||||||
static inline bool exists (const char *pathname)
|
_unused static bool exists (const char *pathname)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
return (stat (pathname, &buf) == 0);
|
return (stat (pathname, &buf) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool existss (const char *pathname)
|
_unused static bool existss (const char *pathname)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
return (stat (pathname, &buf) == 0 && buf.st_size != 0);
|
return (stat (pathname, &buf) == 0 && buf.st_size != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *rc_conf_value (const char *var);
|
char *rc_conf_value (const char *var);
|
||||||
bool rc_conf_yesno (const char *var);
|
bool rc_conf_yesno (const char *var);
|
||||||
char **env_filter (void);
|
char **env_filter (void);
|
||||||
@ -125,7 +130,8 @@ bool service_plugable (const char *service);
|
|||||||
|
|
||||||
/* basename_c never modifies the argument. As such, if there is a trailing
|
/* basename_c never modifies the argument. As such, if there is a trailing
|
||||||
* slash then an empty string is returned. */
|
* slash then an empty string is returned. */
|
||||||
static inline const char *basename_c (const char *path) {
|
_unused static const char *basename_c (const char *path)
|
||||||
|
{
|
||||||
const char *slash = strrchr (path, '/');
|
const char *slash = strrchr (path, '/');
|
||||||
|
|
||||||
if (slash)
|
if (slash)
|
||||||
|
Loading…
Reference in New Issue
Block a user