From 5177898db10de8903b28a45fa0452b4ba8dfaf36 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 11 Oct 2010 17:11:59 -0700 Subject: [PATCH] Use new and delete instead of alloca(). Should put out the burning tinderbox. --- src/rt/rust_log.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp index 74a5d00ef12..20f3f146a88 100644 --- a/src/rt/rust_log.cpp +++ b/src/rt/rust_log.cpp @@ -8,14 +8,13 @@ #include #include #include -#include static uint32_t read_type_bit_mask() { uint32_t bits = rust_log::ULOG | rust_log::ERR; char *env_str = getenv("RUST_LOG"); if (env_str) { - char *str = (char *)alloca(strlen(env_str) + 2); + char *str = new char[strlen(env_str) + 2]; str[0] = ','; strcpy(str + 1, env_str); @@ -38,6 +37,8 @@ read_type_bit_mask() { bits |= strstr(str, ",bt") ? rust_log::BT : 0; bits |= strstr(str, ",all") ? rust_log::ALL : 0; bits = strstr(str, ",none") ? 0 : bits; + + delete[] str; } return bits; }