File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed
Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 66# include "malloc_wrap.h"
77#endif
88
9- int ksprintf (kstring_t * s , const char * fmt , ... )
9+ int bwa_kvsprintf (kstring_t * s , const char * fmt , va_list ap )
1010{
11- va_list ap ;
11+ va_list ap2 ;
1212 int l ;
13- va_start ( ap , fmt );
13+ va_copy ( ap2 , ap );
1414 l = vsnprintf (s -> s + s -> l , s -> m - s -> l , fmt , ap );
15- va_end (ap );
1615 if (l + 1 > s -> m - s -> l ) {
1716 s -> m = s -> l + l + 2 ;
1817 kroundup32 (s -> m );
1918 s -> s = (char * )realloc (s -> s , s -> m );
20- va_start (ap , fmt );
21- l = vsnprintf (s -> s + s -> l , s -> m - s -> l , fmt , ap );
19+ l = vsnprintf (s -> s + s -> l , s -> m - s -> l , fmt , ap2 );
2220 }
23- va_end (ap );
21+ va_end (ap2 );
2422 s -> l += l ;
2523 return l ;
2624}
Original file line number Diff line number Diff line change 33
44#include <stdlib.h>
55#include <string.h>
6+ #include <stdarg.h>
67
78#ifdef USE_MALLOC_WRAPPERS
89# include "malloc_wrap.h"
@@ -110,6 +111,21 @@ static inline int kputl(long c, kstring_t *s)
110111 return 0 ;
111112}
112113
113- int ksprintf (kstring_t * s , const char * fmt , ...);
114+ int bwa_kvsprintf (kstring_t * s , const char * fmt , va_list ap );
115+
116+ static inline int ksprintf (kstring_t * s , const char * fmt , ...)
117+ {
118+ va_list ap ;
119+ int l ;
120+ va_start (ap , fmt );
121+ l = bwa_kvsprintf (s , fmt , ap );
122+ va_end (ap );
123+ return l ;
124+ }
125+
126+ static inline int kvsprintf (kstring_t * s , const char * fmt , va_list ap )
127+ {
128+ return bwa_kvsprintf (s , fmt , ap );
129+ }
114130
115131#endif
You can’t perform that action at this time.
0 commit comments