diff --git a/src/servers/app/ProfileMessageSupport.cpp b/src/servers/app/ProfileMessageSupport.cpp index b51de468ca..9b420b38bb 100644 --- a/src/servers/app/ProfileMessageSupport.cpp +++ b/src/servers/app/ProfileMessageSupport.cpp @@ -12,14 +12,12 @@ #include -void -string_for_message_code(uint32 code, BString& string) +const char* +string_for_message_code(uint32 code) { - string = ""; - switch (code) { // Return the exact name for each constant - #define CODE(x) case x: string = #x; break + #define CODE(x) case x: return #x CODE(AS_GET_DESKTOP); CODE(AS_REGISTER_INPUT_SERVER); @@ -323,7 +321,7 @@ string_for_message_code(uint32 code, BString& string) CODE(AS_COLOR_MAP_UPDATED); default: - string << "unkown code: " << code; + return "unkown code"; break; } } diff --git a/src/servers/app/ProfileMessageSupport.h b/src/servers/app/ProfileMessageSupport.h index a31f201945..8bb05d7a49 100644 --- a/src/servers/app/ProfileMessageSupport.h +++ b/src/servers/app/ProfileMessageSupport.h @@ -12,7 +12,7 @@ #include -void string_for_message_code(uint32 code, BString& string); +const char* string_for_message_code(uint32 code); #endif // PROFILE_MESSAGE_SUPPORT_H diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 8cc29442ca..16901589c1 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -236,13 +236,11 @@ ServerWindow::~ServerWindow() profiles.SortItems(compare_message_profiles); - BString codeName; int32 count = profiles.CountItems(); for (int32 i = 0; i < count; i++) { profile* p = (profile*)profiles.ItemAtFast(i); - string_for_message_code(p->code, codeName); printf("[%s] called %" B_PRId32 " times, %g secs (%" B_PRId64 " usecs " - "per call)\n", codeName.String(), p->count, p->time / 1000000.0, + "per call)\n", string_for_message_code(p->code), p->count, p->time / 1000000.0, p->time / p->count); } if (sRedrawProcessingTime.count > 0) { @@ -1184,11 +1182,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) default: if (fCurrentView == NULL) { - BString codeName; - string_for_message_code(code, codeName); debug_printf("ServerWindow %s received unexpected code - " "message '%s' before top_view attached.\n", - Title(), codeName.String()); + Title(), string_for_message_code(code)); if (link.NeedsReply()) { fLink.StartMessage(B_ERROR); fLink.Flush(); @@ -3220,10 +3216,8 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, } default: - BString codeString; - string_for_message_code(code, codeString); debug_printf("ServerWindow %s received unexpected code: %s\n", - Title(), codeString.String()); + Title(), string_for_message_code(code)); if (link.NeedsReply()) { // the client is now blocking and waiting for a reply!