Sha256: ad21281b1e796ac738ef615b42656b31e8ca3f344e41ae40cfd00cf697783538
Contents?: true
Size: 641 Bytes
Versions: 3
Compression:
Stored size: 641 Bytes
Contents
#include <stdarg.h> #include <stdio.h> #include "kstring.h" int ksprintf(kstring_t *s, const char *fmt, ...) { va_list ap; int l; va_start(ap, fmt); l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); va_end(ap); if (l + 1 > s->m - s->l) { s->m = s->l + l + 2; kroundup32(s->m); s->s = (char*)realloc(s->s, s->m); va_start(ap, fmt); l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); } va_end(ap); s->l += l; return l; } #ifdef KSTRING_MAIN #include <stdio.h> int main() { kstring_t *s; s = (kstring_t*)calloc(1, sizeof(kstring_t)); ksprintf(s, "abcdefg: %d", 100); printf("%s\n", s->s); free(s); return 0; } #endif
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bio-bwa-0.2.2 | ext/kstring.c |
bio-bwa-0.2.1 | ext/kstring.c |
bio-bwa-0.2.0 | ext/kstring.c |