diff options
author | Paul McLean <pmclean@google.com> | 2013-12-19 15:47:29 -0800 |
---|---|---|
committer | Rom Lemarchand <romlem@google.com> | 2014-03-25 19:08:13 +0000 |
commit | 55c640704152694dca1f19bf2a0b86fa2efa99d1 (patch) | |
tree | 5be0f556d4030ef352cfa5afc378e2e526846745 /include/cutils | |
parent | 65ea3cc9077befd29e6a677d833a271ecfeafe62 (diff) | |
download | system_core-55c640704152694dca1f19bf2a0b86fa2efa99d1.zip system_core-55c640704152694dca1f19bf2a0b86fa2efa99d1.tar.gz system_core-55c640704152694dca1f19bf2a0b86fa2efa99d1.tar.bz2 |
Adding a handy predicate function (str_parms_has_key()
Change-Id: I1af5c260a1a820b65f0850ea9adb38b01fcb183c
Diffstat (limited to 'include/cutils')
-rw-r--r-- | include/cutils/str_parms.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/cutils/str_parms.h b/include/cutils/str_parms.h index 247c996..66f3637 100644 --- a/include/cutils/str_parms.h +++ b/include/cutils/str_parms.h @@ -34,6 +34,12 @@ int str_parms_add_int(struct str_parms *str_parms, const char *key, int value); int str_parms_add_float(struct str_parms *str_parms, const char *key, float value); +// Returns non-zero if the str_parms contains the specified key. +int str_parms_has_key(struct str_parms *str_parms, const char *key); + +// Gets value associated with the specified key (if present), placing it in the buffer +// pointed to by the out_val parameter. Returns the length of the returned string value. +// If 'key' isn't in the parms, then return -ENOENT (-2) and leave 'out_val' untouched. int str_parms_get_str(struct str_parms *str_parms, const char *key, char *out_val, int len); int str_parms_get_int(struct str_parms *str_parms, const char *key, |