Skip to content

Commit f8c234e

Browse files
committed
---
yaml --- r: 1241 b: refs/heads/master c: fe1a4ab h: refs/heads/master i: 1239: efda5dd v: v3
1 parent 55a33c8 commit f8c234e

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: bdcb9d9b531c8dc6962d854edfeeeeb9477b40b2
2+
refs/heads/master: fe1a4ab23c6493d72e41b5ed8d87e7741e847154

trunk/src/rt/rust_builtin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ last_os_error(rust_task *task) {
2222
return NULL;
2323
}
2424
#elif defined(_GNU_SOURCE)
25-
char cbuf[1024];
25+
char cbuf[BUF_BYTES];
2626
char *buf = strerror_r(errno, cbuf, sizeof(cbuf));
2727
if (!buf) {
2828
task->fail(1);
2929
return NULL;
3030
}
3131
#else
32-
char buf[1024];
32+
char buf[BUF_BYTES];
3333
int err = strerror_r(errno, buf, sizeof(buf));
3434
if (err) {
3535
task->fail(1);

trunk/src/rt/rust_dom.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ rust_dom::activate(rust_task *task) {
5757

5858
void
5959
rust_dom::log(rust_task *task, uint32_t type_bits, char const *fmt, ...) {
60-
char buf[256];
60+
char buf[BUF_BYTES];
6161
if (_log.is_tracing(type_bits)) {
6262
va_list args;
6363
va_start(args, fmt);
@@ -69,7 +69,7 @@ rust_dom::log(rust_task *task, uint32_t type_bits, char const *fmt, ...) {
6969

7070
void
7171
rust_dom::log(uint32_t type_bits, char const *fmt, ...) {
72-
char buf[256];
72+
char buf[BUF_BYTES];
7373
if (_log.is_tracing(type_bits)) {
7474
va_list args;
7575
va_start(args, fmt);

trunk/src/rt/rust_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ static size_t const TIME_SLICE_IN_MS = 10;
8888

8989
static intptr_t const CONST_REFCOUNT = 0x7badface;
9090

91+
// This accounts for logging buffers.
92+
93+
static size_t const BUF_BYTES = 1024;
94+
9195
// Every reference counted object should derive from this base class.
9296

9397
template <typename T> struct rc_base {

trunk/src/rt/rust_log.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ append_string(char *buffer, rust_log::ansi_color color,
136136

137137
void
138138
rust_log::trace_ln(uint32_t thread_id, char *prefix, char *message) {
139-
char buffer[1024] = "";
139+
char buffer[BUF_BYTES] = "";
140140
_log_lock.lock();
141141
append_string(buffer, "%-34s", prefix);
142142
for (uint32_t i = 0; i < _indent; i++) {
@@ -158,7 +158,7 @@ rust_log::trace_ln(rust_task *task, char *message) {
158158
#else
159159
uint32_t thread_id = hash((uint32_t) pthread_self());
160160
#endif
161-
char prefix[1024] = "";
161+
char prefix[BUF_BYTES] = "";
162162
if (_dom && _dom->name) {
163163
append_string(prefix, "%04" PRIxPTR ":%.10s:",
164164
thread_id, _dom->name);

trunk/src/rt/rust_srv.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ rust_srv::rust_srv() :
1212
}
1313

1414
rust_srv::~rust_srv() {
15-
// char msg[1024];
15+
// char msg[BUF_BYTES];
1616
// snprintf(msg, sizeof(msg), "~rust_srv %" PRIxPTR, (uintptr_t) this);
1717
// log(msg);
1818
}
@@ -43,13 +43,13 @@ rust_srv::fatal(const char *expression,
4343
size_t line,
4444
const char *format,
4545
...) {
46-
char buf[1024];
46+
char buf[BUF_BYTES];
4747
va_list args;
4848
va_start(args, format);
4949
vsnprintf(buf, sizeof(buf), format, args);
5050
va_end(args);
5151

52-
char msg[1024];
52+
char msg[BUF_BYTES];
5353
snprintf(msg, sizeof(msg),
5454
"fatal, '%s' failed, %s:%d %s",
5555
expression, file, (int)line, buf);
@@ -63,13 +63,13 @@ rust_srv::warning(char const *expression,
6363
size_t line,
6464
const char *format,
6565
...) {
66-
char buf[1024];
66+
char buf[BUF_BYTES];
6767
va_list args;
6868
va_start(args, format);
6969
vsnprintf(buf, sizeof(buf), format, args);
7070
va_end(args);
7171

72-
char msg[1024];
72+
char msg[BUF_BYTES];
7373
snprintf(msg, sizeof(msg),
7474
"warning: '%s', at: %s:%d %s",
7575
expression, file, (int)line, buf);

0 commit comments

Comments
 (0)