extern smallint logmode;
extern uint8_t xfunc_error_retval;
extern void (*die_func)(void);
-extern void xfunc_die(void) NORETURN FAST_FUNC;
-extern void bb_show_usage(void) NORETURN FAST_FUNC;
-extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
-extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
-extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
-extern void bb_simple_perror_msg(const char *s) FAST_FUNC;
-extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
-extern void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC;
-extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
-extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
-extern void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC;
-extern void bb_perror_nomsg(void) FAST_FUNC;
-extern void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
-extern void bb_logenv_override(void) FAST_FUNC;
+void xfunc_die(void) NORETURN FAST_FUNC;
+void bb_show_usage(void) NORETURN FAST_FUNC;
+void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
+void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_perror_msg(const char *s) FAST_FUNC;
+void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
+void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC;
+void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
+void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
+void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC;
+void bb_perror_nomsg(void) FAST_FUNC;
+void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
+void bb_die_memory_exhausted(void) NORETURN FAST_FUNC;
+void bb_logenv_override(void) FAST_FUNC;
/* We need to export XXX_main from libbusybox
* only if we build "individual" binaries
* fail, so callers never need to check for errors. If it returned, it
* succeeded. */
+void FAST_FUNC bb_die_memory_exhausted(void)
+{
+ bb_error_msg_and_die(bb_msg_memory_exhausted);
+}
+
#ifndef DMALLOC
/* dmalloc provides variants of these that do abort() on failure.
* Since dmalloc's prototypes overwrite the impls here as they are
{
void *ptr = malloc(size);
if (ptr == NULL && size != 0)
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
return ptr;
}
{
ptr = realloc(ptr, size);
if (ptr == NULL && size != 0)
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
return ptr;
}
#endif /* DMALLOC */
t = strdup(s);
if (t == NULL)
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
return t;
}
va_end(p);
if (r < 0)
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
return string_ptr;
}
void FAST_FUNC xsetenv(const char *key, const char *value)
{
if (setenv(key, value, 1))
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
}
/* Handles "VAR=VAL" strings, even those which are part of environ
return o_save_ptr_helper(o, n);
}
if (gr == GLOB_NOSPACE)
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
/* GLOB_ABORTED? Only happens with GLOB_ERR flag,
* but we didn't specify it. Paranoia again. */
bb_error_msg_and_die("glob error %d on '%s'", gr, pattern);
goto literal;
}
if (gr == GLOB_NOSPACE)
- bb_error_msg_and_die(bb_msg_memory_exhausted);
+ bb_die_memory_exhausted();
/* GLOB_ABORTED? Only happens with GLOB_ERR flag,
* but we didn't specify it. Paranoia again. */
bb_error_msg_and_die("glob error %d on '%s'", gr, pattern);