mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-14 10:50:27 +00:00
- Code aufgeraeumt, Tests auf C99-vsnprintf() entfernt (fuer ngIRCd unnoetig).
This commit is contained in:
parent
31a3bfed54
commit
c5461c4596
@ -9,9 +9,9 @@
|
|||||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||||
*
|
*
|
||||||
* $Id: vsnprintf.c,v 1.1 2002/05/19 01:17:40 alex Exp $
|
* $Id: vsnprintf.c,v 1.2 2002/05/19 10:44:52 alex Exp $
|
||||||
*
|
*
|
||||||
* vsnprintf.c: vsnprintf()-Ersatz
|
* vsnprintf.c: u.a. Ersatz fuer vsnprintf()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -65,13 +65,16 @@
|
|||||||
* missing. Some systems only have snprintf() but not vsnprintf(), so
|
* missing. Some systems only have snprintf() but not vsnprintf(), so
|
||||||
* the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
|
* the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
|
||||||
*
|
*
|
||||||
* Andrew Tridgell (tridge@samba.org) Oct 1998
|
* Andrew Tridgell <tridge@samba.org>, October 1998
|
||||||
* fixed handling of %.0f
|
* fixed handling of %.0f
|
||||||
* added test for HAVE_LONG_DOUBLE
|
* added test for HAVE_LONG_DOUBLE
|
||||||
*
|
*
|
||||||
* tridge@samba.org, idra@samba.org, April 2001
|
* tridge@samba.org, idra@samba.org, April 2001
|
||||||
* got rid of fcvt code (twas buggy and made testing harder)
|
* got rid of fcvt code (twas buggy and made testing harder)
|
||||||
* added C99 semantics
|
* added C99 semantics
|
||||||
|
*
|
||||||
|
* Alexander Barton, <alex@barton.de>, 2002-05-19
|
||||||
|
* removed [v]asprintf() and C99 tests: not needed by ngIRCd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -90,7 +93,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF)
|
|
||||||
|
#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF)
|
||||||
/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
|
/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
/* make the compiler happy with an empty file */
|
/* make the compiler happy with an empty file */
|
||||||
@ -763,14 +767,14 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
|
|||||||
(*currlen)++;
|
(*currlen)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
|
#if !defined(HAVE_VSNPRINTF)
|
||||||
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
return dopr(str, count, fmt, args);
|
return dopr(str, count, fmt, args);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
|
#if !defined(HAVE_SNPRINTF)
|
||||||
int snprintf(char *str,size_t count,const char *fmt,...)
|
int snprintf(char *str,size_t count,const char *fmt,...)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
@ -785,36 +789,6 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_VASPRINTF
|
|
||||||
int vasprintf(char **ptr, const char *format, va_list ap)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = vsnprintf(NULL, 0, format, ap);
|
|
||||||
if (ret <= 0) return ret;
|
|
||||||
|
|
||||||
(*ptr) = (char *)malloc(ret+1);
|
|
||||||
if (!*ptr) return -1;
|
|
||||||
ret = vsnprintf(*ptr, ret+1, format, ap);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_ASPRINTF
|
|
||||||
int asprintf(char **ptr, const char *format, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
va_start(ap, format);
|
|
||||||
ret = vasprintf(ptr, format, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TEST_SNPRINTF
|
#ifdef TEST_SNPRINTF
|
||||||
int sprintf(char *str,const char *fmt,...);
|
int sprintf(char *str,const char *fmt,...);
|
||||||
|
Loading…
Reference in New Issue
Block a user