C++: Make write{Struct,Field}Begin take "name" as a const char*.

Summary:
These methods previously took name as a const string&.  While that way
is more idiomatic, it requires a temporary string to be constructed
when we pass a string literal (which is always).  This was significantly
slowing down the serialization of field-heavy structures.  This change
will break ABI compatibility, but the serialization speed boost with
no external API changes is too important to pass up.

Reviewed By: mcslee, aditya

Test Plan: make check

TracCamp Project: Thrift

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665672 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TDebugProtocol.cpp b/lib/cpp/src/protocol/TDebugProtocol.cpp
index 4cc3df8..92e9d36 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.cpp
+++ b/lib/cpp/src/protocol/TDebugProtocol.cpp
@@ -152,10 +152,10 @@
   return writeIndented(")\n");
 }
 
-uint32_t TDebugProtocol::writeStructBegin(const string& name) {
+uint32_t TDebugProtocol::writeStructBegin(const char* name) {
   uint32_t size = 0;
   size += startItem();
-  size += writePlain(name + " {\n");
+  size += writePlain(string(name) + " {\n");
   indentUp();
   write_state_.push_back(STRUCT);
   return size;
@@ -170,7 +170,7 @@
   return size;
 }
 
-uint32_t TDebugProtocol::writeFieldBegin(const string& name,
+uint32_t TDebugProtocol::writeFieldBegin(const char* name,
                                          const TType fieldType,
                                          const int16_t fieldId) {
   // sprintf(id_str, "%02d", fieldId);