diff options
author | hunt <hunt> | 2006-04-10 04:44:21 +0000 |
---|---|---|
committer | hunt <hunt> | 2006-04-10 04:44:21 +0000 |
commit | e06d0f85845165d3d9333fe9e98deade672cd4c8 (patch) | |
tree | 4da3cc15703a063437a20cc3737921df3daee34c /runtime/string.c | |
parent | a886ce75c650dcbefc56ba458ecbd568f945fb3b (diff) | |
download | systemtap-steved-e06d0f85845165d3d9333fe9e98deade672cd4c8.tar.gz systemtap-steved-e06d0f85845165d3d9333fe9e98deade672cd4c8.tar.xz systemtap-steved-e06d0f85845165d3d9333fe9e98deade672cd4c8.zip |
2006-04-09 Martin Hunt <hunt@redhat.com>
* print.c (_stp_print_flush): Send 'len" bytes
instead of 'len+1', which included terminating 0.
* string.c (_stp_sprintf): Call _stp_vsnprintf()
instead of vsnprintf().
(_stp_vsprintf): Ditto.
* vsprintf.c: New file.
Diffstat (limited to 'runtime/string.c')
-rw-r--r-- | runtime/string.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/string.c b/runtime/string.c index f3e88ea3..efb4d595 100644 --- a/runtime/string.c +++ b/runtime/string.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * String Functions - * Copyright (C) 2005 Red Hat Inc. + * Copyright (C) 2005, 2006 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -63,7 +63,7 @@ void _stp_sprintf (String str, const char *fmt, ...) char *buf = &_stp_pbuf[cpu][STP_PRINT_BUF_START] + _stp_pbuf_len[cpu]; int size = STP_PRINT_BUF_LEN -_stp_pbuf_len[cpu] + 1; va_start(args, fmt); - num = vsnprintf(buf, size, fmt, args); + num = _stp_vsnprintf(buf, size, fmt, args); va_end(args); if (unlikely(num >= size)) { /* overflowed the buffer */ @@ -83,7 +83,7 @@ void _stp_sprintf (String str, const char *fmt, ...) } else { va_start(args, fmt); - num = vscnprintf(str->buf + str->len, STP_STRING_SIZE - str->len, fmt, args); + num = _stp_vscnprintf(str->buf + str->len, STP_STRING_SIZE - str->len, fmt, args); va_end(args); if (likely(num > 0)) str->len += num; @@ -101,7 +101,7 @@ void _stp_vsprintf (String str, const char *fmt, va_list args) int cpu = smp_processor_id(); char *buf = &_stp_pbuf[cpu][STP_PRINT_BUF_START] + _stp_pbuf_len[cpu]; int size = STP_PRINT_BUF_LEN -_stp_pbuf_len[cpu] + 1; - num = vsnprintf(buf, size, fmt, args); + num = _stp_vsnprintf(buf, size, fmt, args); if (num < size) _stp_pbuf_len[cpu] += num; else { @@ -109,7 +109,7 @@ void _stp_vsprintf (String str, const char *fmt, va_list args) _stp_print_flush(); } } else { - num = vscnprintf(str->buf + str->len, STP_STRING_SIZE - str->len, fmt, args); + num = _stp_vscnprintf(str->buf + str->len, STP_STRING_SIZE - str->len, fmt, args); if (num > 0) str->len += num; } |