summaryrefslogtreecommitdiff
path: root/libs/utils/String8.cpp
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2010-11-18 14:20:30 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2010-11-18 14:20:30 -0800
commit98dc391e20e0a27cd143cbdf62f8f306dba3fa83 (patch)
tree119214c6e9d6a946df03ebfbe906651feb0f1668 /libs/utils/String8.cpp
parent35cf947565aca616fe461283602b2c21c8264712 (diff)
parenta3477c862a5debcac7dfb076749059406ec59512 (diff)
Merge "Added support for full PC-style keyboards."
Diffstat (limited to 'libs/utils/String8.cpp')
-rw-r--r--libs/utils/String8.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp
index c8dc0838dc..e531a2a0f0 100644
--- a/libs/utils/String8.cpp
+++ b/libs/utils/String8.cpp
@@ -282,22 +282,28 @@ status_t String8::append(const char* other, size_t otherLen)
status_t String8::appendFormat(const char* fmt, ...)
{
- va_list ap;
- va_start(ap, fmt);
+ va_list args;
+ va_start(args, fmt);
+ status_t result = appendFormatV(fmt, args);
+
+ va_end(args);
+ return result;
+}
+
+status_t String8::appendFormatV(const char* fmt, va_list args)
+{
int result = NO_ERROR;
- int n = vsnprintf(NULL, 0, fmt, ap);
+ int n = vsnprintf(NULL, 0, fmt, args);
if (n != 0) {
size_t oldLength = length();
char* buf = lockBuffer(oldLength + n);
if (buf) {
- vsnprintf(buf + oldLength, n + 1, fmt, ap);
+ vsnprintf(buf + oldLength, n + 1, fmt, args);
} else {
result = NO_MEMORY;
}
}
-
- va_end(ap);
return result;
}