logd: white and black switch to std::string

(cherry pick commit from b332f1c427)

Bug: 23350706
Change-Id: I92f21aee0a9702f63e8465851d0f35007b0469a7
This commit is contained in:
Mark Salyzyn 2015-08-19 13:53:20 -07:00 committed by Rom Lemarchand
parent 2a2b0d1c6e
commit 8a7f778c01

View file

@ -16,7 +16,9 @@
#include <ctype.h> #include <ctype.h>
#include <utils/String8.h> #include <string>
#include <base/stringprintf.h>
#include "LogWhiteBlackList.h" #include "LogWhiteBlackList.h"
@ -176,10 +178,10 @@ void PruneList::format(char **strp) {
static const char nice_format[] = " %s"; static const char nice_format[] = " %s";
const char *fmt = nice_format + 1; const char *fmt = nice_format + 1;
android::String8 string; std::string string;
if (mWorstUidEnabled) { if (mWorstUidEnabled) {
string.setTo("~!"); string = "~!";
fmt = nice_format; fmt = nice_format;
} }
@ -189,7 +191,7 @@ void PruneList::format(char **strp) {
char *a = NULL; char *a = NULL;
(*it).format(&a); (*it).format(&a);
string.appendFormat(fmt, a); string += android::base::StringPrintf(fmt, a);
fmt = nice_format; fmt = nice_format;
free(a); free(a);
@ -201,13 +203,13 @@ void PruneList::format(char **strp) {
char *a = NULL; char *a = NULL;
(*it).format(&a); (*it).format(&a);
string.appendFormat(fmt, a); string += android::base::StringPrintf(fmt, a);
fmt = naughty_format; fmt = naughty_format;
free(a); free(a);
} }
*strp = strdup(string.string()); *strp = strdup(string.c_str());
} }
// ToDo: Lists are in sorted order, Prune->cmp() returns + or - // ToDo: Lists are in sorted order, Prune->cmp() returns + or -