64
64
/* JAM: changed declarations to xmpp_snprintf and xmpp_vsnprintf to
65
65
avoid namespace collision. */
66
66
67
- #if !defined( HAVE_SNPRINTF ) || !defined( HAVE_VSNPRINTF )
67
+ #include "snprintf.h"
68
68
69
- #include <string.h>
70
- #include <ctype.h>
71
- #include <sys/types.h>
72
-
73
- /* Define this as a fall through, HAVE_STDARG_H is probably already set */
74
-
75
- #define HAVE_VARARGS_H
76
- #define HAVE_STDARG_H /* JAM: set always */
69
+ /* varargs declarations: */
77
70
71
+ #include <stdarg.h>
72
+ #define VA_LOCAL_DECL va_list ap
73
+ #define VA_START (f ) va_start(ap, f)
74
+ #define VA_END va_end(ap)
78
75
79
- /* varargs declarations: */
76
+ #ifndef HAVE_VSNPRINTF
80
77
81
- #if defined(HAVE_STDARG_H )
82
- # include <stdarg.h>
83
- # define HAVE_STDARGS /* let's hope that works everywhere (mj) */
84
- # define VA_LOCAL_DECL va_list ap
85
- # define VA_START (f ) va_start(ap, f)
86
- # define VA_SHIFT (v ,t ) ; /* no-op for ANSI */
87
- # define VA_END va_end(ap)
88
- #else
89
- # if defined(HAVE_VARARGS_H )
90
- # include <varargs.h>
91
- # undef HAVE_STDARGS
92
- # define VA_LOCAL_DECL va_list ap
93
- # define VA_START (f ) va_start(ap) /* f is ignored! */
94
- # define VA_SHIFT (v ,t ) v = va_arg(ap,t)
95
- # define VA_END va_end(ap)
96
- # else
97
- /*XX ** NO VARARGS ** XX*/
98
- # endif
99
- #endif
78
+ #include <string.h>
79
+ #include <ctype.h>
80
+ #include <sys/types.h>
100
81
101
82
#ifdef HAVE_LONG_DOUBLE
102
83
#define LDOUBLE long double
103
84
#else
104
85
#define LDOUBLE double
105
86
#endif
106
87
107
- int xmpp_snprintf (char * str , size_t count , const char * fmt , ...);
108
- int xmpp_vsnprintf (char * str , size_t count , const char * fmt , va_list arg );
109
-
110
88
static int dopr (char * buffer , size_t maxlen , const char * format ,
111
89
va_list args );
112
90
static int fmtstr (char * buffer , size_t * currlen , size_t maxlen ,
@@ -725,7 +703,6 @@ static int dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c)
725
703
return 1 ;
726
704
}
727
705
728
- #ifndef HAVE_VSNPRINTF
729
706
int xmpp_vsnprintf (char * str , size_t count , const char * fmt , va_list args )
730
707
{
731
708
if (str != NULL )
@@ -736,28 +713,14 @@ int xmpp_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
736
713
737
714
#ifndef HAVE_SNPRINTF
738
715
/* VARARGS3 */
739
- #ifdef HAVE_STDARGS
740
716
int xmpp_snprintf (char * str ,size_t count ,const char * fmt ,...)
741
- #else
742
- int xmpp_snprintf (va_alist ) va_dcl
743
- #endif
744
717
{
745
- #ifndef HAVE_STDARGS
746
- char * str ;
747
- size_t count ;
748
- char * fmt ;
749
- #endif
750
718
VA_LOCAL_DECL ;
751
719
int total ;
752
720
753
721
VA_START (fmt );
754
- VA_SHIFT (str , char * );
755
- VA_SHIFT (count , size_t );
756
- VA_SHIFT (fmt , char * );
757
722
total = xmpp_vsnprintf (str , count , fmt , ap );
758
723
VA_END ;
759
724
return total ;
760
725
}
761
726
#endif /* !HAVE_SNPRINTF */
762
-
763
- #endif /* !HAVE_SNPRINTF */
0 commit comments