diff options
author | hunt <hunt> | 2005-05-31 20:26:38 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-05-31 20:26:38 +0000 |
commit | 55a163fc934622ec2b94551b8cd0e57a33b1a905 (patch) | |
tree | f5127eb771caa4cfb4c5c69f75cb293992e93d2d /runtime/string.c | |
parent | f541970f10c03b788141b359689e2a847b7684c4 (diff) | |
download | systemtap-steved-55a163fc934622ec2b94551b8cd0e57a33b1a905.tar.gz systemtap-steved-55a163fc934622ec2b94551b8cd0e57a33b1a905.tar.xz systemtap-steved-55a163fc934622ec2b94551b8cd0e57a33b1a905.zip |
2005-05-31 Martin Hunt <hunt@redhat.com>
* map.c (_stp_map_print): Now takes a format string instead of a name.
* map.h (foreach): Update macro.
* string.c (_stp_string_cat_char): New function. Append a char
to a string.
Diffstat (limited to 'runtime/string.c')
-rw-r--r-- | runtime/string.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/runtime/string.c b/runtime/string.c index f079bf89..1f0edbb8 100644 --- a/runtime/string.c +++ b/runtime/string.c @@ -175,6 +175,29 @@ void _stp_string_cat_string (String str1, String str2) } +void _stp_string_cat_char (String str1, const char c) +{ + if (str1 == _stp_stdout) { + char *buf; + int cpu = smp_processor_id(); + int size = STP_PRINT_BUF_LEN -_stp_pbuf_len[cpu]; + if (1 >= size) + _stp_print_flush(); + buf = &_stp_pbuf[cpu][STP_PRINT_BUF_START] + _stp_pbuf_len[cpu]; + buf[0] = c; + buf[1] = 0; + _stp_pbuf_len[cpu] ++; + } else { + int size = STP_STRING_SIZE - str1->len - 1; + if (size > 0) { + char *buf = str1->buf + str1->len; + buf[0] = c; + buf[1] = 0; + str1->len ++; + } + } +} + /** Get a pointer to String's buffer * For rare cases when a C string is needed and you have a String. * One example is when you want to print a String with _stp_printf(). |