summaryrefslogtreecommitdiff
path: root/libbb/xfuncs_printf.c
diff options
context:
space:
mode:
authorDan Fandrich2009-10-27 11:05:00 +0100
committerDenys Vlasenko2009-10-27 11:05:00 +0100
commit21a542d7d732735a522c413c0c385e577528ec63 (patch)
treef0873e7eb57524ca9306d12b6dd2ecd5224f8a0a /libbb/xfuncs_printf.c
parentd83bbf41934382631161845302f5d77027383aba (diff)
downloadbusybox-21a542d7d732735a522c413c0c385e577528ec63.zip
busybox-21a542d7d732735a522c413c0c385e577528ec63.tar.gz
platform compatibility work (by Dan Fandrich)
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/xfuncs_printf.c')
-rw-r--r--libbb/xfuncs_printf.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index aaf9989..345c842 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -283,60 +283,15 @@ char* FAST_FUNC xasprintf(const char *format, ...)
int r;
char *string_ptr;
-#if 1
- // GNU extension
va_start(p, format);
r = vasprintf(&string_ptr, format, p);
va_end(p);
-#else
- // Bloat for systems that haven't got the GNU extension.
- va_start(p, format);
- r = vsnprintf(NULL, 0, format, p);
- va_end(p);
- string_ptr = xmalloc(r+1);
- va_start(p, format);
- r = vsnprintf(string_ptr, r+1, format, p);
- va_end(p);
-#endif
if (r < 0)
bb_error_msg_and_die(bb_msg_memory_exhausted);
return string_ptr;
}
-#if 0 /* If we will ever meet a libc which hasn't [f]dprintf... */
-int FAST_FUNC fdprintf(int fd, const char *format, ...)
-{
- va_list p;
- int r;
- char *string_ptr;
-
-#if 1
- // GNU extension
- va_start(p, format);
- r = vasprintf(&string_ptr, format, p);
- va_end(p);
-#else
- // Bloat for systems that haven't got the GNU extension.
- va_start(p, format);
- r = vsnprintf(NULL, 0, format, p) + 1;
- va_end(p);
- string_ptr = malloc(r);
- if (string_ptr) {
- va_start(p, format);
- r = vsnprintf(string_ptr, r, format, p);
- va_end(p);
- }
-#endif
-
- if (r >= 0) {
- full_write(fd, string_ptr, r);
- free(string_ptr);
- }
- return r;
-}
-#endif
-
void FAST_FUNC xsetenv(const char *key, const char *value)
{
if (setenv(key, value, 1))