am 6e9798f2: Merge "logd: fix format-extra-args warning."
* commit '6e9798f2e44c82b0cd8257f96b7d23285a7edc67': logd: fix format-extra-args warning.
This commit is contained in:
commit
b51e3dbdd8
3 changed files with 28 additions and 13 deletions
|
|
@ -671,8 +671,11 @@ void LogStatistics::format(char **buf,
|
||||||
size_t sizesTotal = p->sizesTotal();
|
size_t sizesTotal = p->sizesTotal();
|
||||||
|
|
||||||
android::String8 sz("");
|
android::String8 sz("");
|
||||||
sz.appendFormat((sizes != sizesTotal) ? "%zu/%zu" : "%zu",
|
if (sizes == sizesTotal) {
|
||||||
sizes, sizesTotal);
|
sz.appendFormat("%zu", sizes);
|
||||||
|
} else {
|
||||||
|
sz.appendFormat("%zu/%zu", sizes, sizesTotal);
|
||||||
|
}
|
||||||
|
|
||||||
android::String8 pd("");
|
android::String8 pd("");
|
||||||
pd.appendFormat("%u%c", pid, p->pidGone() ? '?' : ' ');
|
pd.appendFormat("%u%c", pid, p->pidGone() ? '?' : ' ');
|
||||||
|
|
@ -783,12 +786,15 @@ void LogStatistics::format(char **buf,
|
||||||
PidStatistics *pp = *pt;
|
PidStatistics *pp = *pt;
|
||||||
pid_t p = pp->getPid();
|
pid_t p = pp->getPid();
|
||||||
|
|
||||||
intermediate = string.format(oneline
|
if (!oneline) {
|
||||||
? ((p == PidStatistics::gone)
|
intermediate = string.format("%d", u);
|
||||||
? "%d/?"
|
} else if (p == PidStatistics::gone) {
|
||||||
: "%d/%d%c")
|
intermediate = string.format("%d/?", u);
|
||||||
: "%d",
|
} else if (pp->pidGone()) {
|
||||||
u, p, pp->pidGone() ? '?' : '\0');
|
intermediate = string.format("%d/%d?", u, p);
|
||||||
|
} else {
|
||||||
|
intermediate = string.format("%d/%d", u, p);
|
||||||
|
}
|
||||||
string.appendFormat(first ? "\n%-12s" : "%-12s",
|
string.appendFormat(first ? "\n%-12s" : "%-12s",
|
||||||
intermediate.string());
|
intermediate.string());
|
||||||
intermediate.clear();
|
intermediate.clear();
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,15 @@ int Prune::cmp(uid_t uid, pid_t pid) const {
|
||||||
|
|
||||||
void Prune::format(char **strp) {
|
void Prune::format(char **strp) {
|
||||||
if (mUid != uid_all) {
|
if (mUid != uid_all) {
|
||||||
asprintf(strp, (mPid != pid_all) ? "%u/%u" : "%u", mUid, mPid);
|
if (mPid != pid_all) {
|
||||||
} else {
|
asprintf(strp, "%u/%u", mUid, mPid);
|
||||||
// NB: mPid == pid_all can not happen if mUid == uid_all
|
} else {
|
||||||
asprintf(strp, (mPid != pid_all) ? "/%u" : "/", mPid);
|
asprintf(strp, "%u", mUid);
|
||||||
|
}
|
||||||
|
} else if (mPid != pid_all) {
|
||||||
|
asprintf(strp, "/%u", mPid);
|
||||||
|
} else { // NB: mPid == pid_all can not happen if mUid == uid_all
|
||||||
|
asprintf(strp, "/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,11 @@ static void dump_log_msg(const char *prefix,
|
||||||
if (((p - cp) > 3) && !*p && ((unsigned int)(p - cp) < len)) {
|
if (((p - cp) > 3) && !*p && ((unsigned int)(p - cp) < len)) {
|
||||||
fprintf(stderr, "\"");
|
fprintf(stderr, "\"");
|
||||||
while (*cp) {
|
while (*cp) {
|
||||||
fprintf(stderr, (*cp != '\n') ? "%c" : "\\n", *cp);
|
if (*cp != '\n') {
|
||||||
|
fprintf(stderr, "%c", *cp);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "\\n");
|
||||||
|
}
|
||||||
++cp;
|
++cp;
|
||||||
--len;
|
--len;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue