mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
Bug 6829 - asprintf for Solaris
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@18755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -71,6 +71,7 @@ int unsetenv(const char *name);
|
|||||||
#endif
|
#endif
|
||||||
#endif /* __CYGWIN__ */
|
#endif /* __CYGWIN__ */
|
||||||
|
|
||||||
|
#define HAVE_ASPRINTF
|
||||||
#define HAVE_VASPRINTF
|
#define HAVE_VASPRINTF
|
||||||
#define HAVE_STRTOQ
|
#define HAVE_STRTOQ
|
||||||
|
|
||||||
@@ -89,6 +90,7 @@ int unsetenv(const char *name);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SOLARIS
|
#ifdef SOLARIS
|
||||||
|
#undef HAVE_ASPRINTF
|
||||||
#undef HAVE_VASPRINTF
|
#undef HAVE_VASPRINTF
|
||||||
#undef HAVE_STRTOQ
|
#undef HAVE_STRTOQ
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
34
utils.c
34
utils.c
@@ -766,6 +766,40 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
|
#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Based on Code from bsd-asprintf from OpenSSH
|
||||||
|
* Copyright (c) 2004 Darren Tucker.
|
||||||
|
*
|
||||||
|
* Based originally on asprintf.c from OpenBSD:
|
||||||
|
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
#if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
|
||||||
|
int asprintf(char **str, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
*str = NULL;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
ret = vasprintf(str, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif /* !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
|
||||||
|
|
||||||
#ifndef HAVE_STRTOQ
|
#ifndef HAVE_STRTOQ
|
||||||
#ifndef LONG_MIN
|
#ifndef LONG_MIN
|
||||||
#define LONG_MIN (-9223372036854775807L-1L)
|
#define LONG_MIN (-9223372036854775807L-1L)
|
||||||
|
|||||||
Reference in New Issue
Block a user