aboutsummaryrefslogtreecommitdiffstats
path: root/android/utils
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-03-01 14:50:07 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-03-01 16:07:28 +0100
commit062dd6a8b90c7c553a6a7257e9c245276b1dd969 (patch)
treef6be79b958ef06be1811c642da4a656e7dc63697 /android/utils
parentfd59c330bec77e7b9241e478efb1e1c508480d1d (diff)
downloadexternal_qemu-062dd6a8b90c7c553a6a7257e9c245276b1dd969.zip
external_qemu-062dd6a8b90c7c553a6a7257e9c245276b1dd969.tar.gz
external_qemu-062dd6a8b90c7c553a6a7257e9c245276b1dd969.tar.bz2
Move some serial ports initialization to the core.
This moves the initialization of the ports used by qemud and the "kmsg" component to the core. + Gets rid of the -old-system option used to suppot pre-1.4 Android system. We don't officially support anything before 1.5 anyway. Change-Id: Ied7e284d952adfd3419d96c39a7c48761f1b3f5c
Diffstat (limited to 'android/utils')
-rw-r--r--android/utils/stralloc.c36
-rw-r--r--android/utils/stralloc.h5
2 files changed, 40 insertions, 1 deletions
diff --git a/android/utils/stralloc.c b/android/utils/stralloc.c
index 2a924e4..ce5d800 100644
--- a/android/utils/stralloc.c
+++ b/android/utils/stralloc.c
@@ -19,7 +19,7 @@
#include <limits.h>
extern void
-stralloc_tabular( stralloc_t* out,
+stralloc_tabular( stralloc_t* out,
const char** strings, int count,
const char* prefix, int width )
{
@@ -138,6 +138,40 @@ stralloc_cstr( stralloc_t* s )
return s->s;
}
+void
+stralloc_lstrip( stralloc_t* s )
+{
+ int count;
+
+ for (count = 0; count < s->n; count++) {
+ if (s->s[count] != ' ' && s->s[count] != '\t')
+ break;
+ }
+
+ if (count > 0) {
+ memmove(s->s, s->s + count, s->n - count);
+ s->n -= count;
+ }
+}
+
+void
+stralloc_rstrip( stralloc_t* s )
+{
+ int count = s->n;
+
+ while (count > 0 && (s->s[count-1] == ' ' || s->s[count-1] == '\t'))
+ count--;
+
+ s->n = count;
+}
+
+void
+stralloc_strip( stralloc_t* s )
+{
+ stralloc_rstrip(s);
+ stralloc_lstrip(s);
+}
+
extern char*
stralloc_to_tempstr( stralloc_t* s )
{
diff --git a/android/utils/stralloc.h b/android/utils/stralloc.h
index 4d17060..626a638 100644
--- a/android/utils/stralloc.h
+++ b/android/utils/stralloc.h
@@ -52,6 +52,11 @@ extern void stralloc_add_quote_bytes( stralloc_t* s, const void* from, unsig
extern void stralloc_add_hex( stralloc_t* s, unsigned value, int num_digits );
extern void stralloc_add_hexdump( stralloc_t* s, void* base, int size, const char* prefix );
+/* Remove leading, trailing or leading+trailing whitespace */
+extern void stralloc_lstrip( stralloc_t* s );
+extern void stralloc_rstrip( stralloc_t* s );
+extern void stralloc_strip( stralloc_t* s );
+
extern void stralloc_tabular( stralloc_t* s, const char** strings, int count,
const char* prefix, int width );