Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 The Android Open Source Project | 2 * Copyright (C) 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
| 6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
| 7 * | 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * | 9 * |
| 10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
| 11 * distributed under the License is distributed on an "AS IS" BASIS, | 11 * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 * See the License for the specific language governing permissions and | 13 * See the License for the specific language governing permissions and |
| 14 * limitations under the License. | 14 * limitations under the License. |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 #ifndef __CUTILS_PROPERTIES_H | 17 #ifndef __CUTILS_PROPERTIES_H |
| 18 #define __CUTILS_PROPERTIES_H | 18 #define __CUTILS_PROPERTIES_H |
| 19 | 19 |
| 20 #include <sys/cdefs.h> | 20 #include <sys/cdefs.h> |
| 21 #include <stddef.h> | 21 #include <stddef.h> |
| 22 #include <sys/system_properties.h> | |
|
rjkroege
2014/04/25 21:28:07
could you introduce a #define to leave this also c
| |
| 23 | 22 |
| 24 #ifdef __cplusplus | 23 #ifdef __cplusplus |
| 25 extern "C" { | 24 extern "C" { |
| 26 #endif | 25 #endif |
| 27 | 26 |
| 28 /* System properties are *small* name value pairs managed by the | 27 /* System properties are *small* name value pairs managed by the |
| 29 ** property service. If your data doesn't fit in the provided | 28 ** property service. If your data doesn't fit in the provided |
| 30 ** space it is not appropriate for a system property. | 29 ** space it is not appropriate for a system property. |
| 31 ** | 30 ** |
| 32 ** WARNING: system/bionic/include/sys/system_properties.h also defines | 31 ** WARNING: system/bionic/include/sys/system_properties.h also defines |
| 33 ** these, but with different names. (TODO: fix that) | 32 ** these, but with different names. (TODO: fix that) |
| 34 */ | 33 */ |
| 35 #define PROPERTY_KEY_MAX PROP_NAME_MAX | 34 #define PROPERTY_KEY_MAX 32 |
| 36 #define PROPERTY_VALUE_MAX PROP_VALUE_MAX | 35 #define PROPERTY_VALUE_MAX 92 |
| 37 | 36 |
| 38 /* property_get: returns the length of the value which will never be | 37 /* property_get: returns the length of the value which will never be |
| 39 ** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated. | 38 ** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated. |
| 40 ** (the length does not include the terminating zero). | 39 ** (the length does not include the terminating zero). |
| 41 ** | 40 ** |
| 42 ** If the property read fails or returns an empty value, the default | 41 ** If the property read fails or returns an empty value, the default |
| 43 ** value is used (if nonnull). | 42 ** value is used (if nonnull). |
| 44 */ | 43 */ |
| 45 int property_get(const char *key, char *value, const char *default_value); | 44 int property_get(const char *key, char *value, const char *default_value); |
| 46 | 45 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 kSystemPropertyList | 80 kSystemPropertyList |
| 82 }; | 81 }; |
| 83 #endif /*HAVE_SYSTEM_PROPERTY_SERVER*/ | 82 #endif /*HAVE_SYSTEM_PROPERTY_SERVER*/ |
| 84 | 83 |
| 85 | 84 |
| 86 #ifdef __cplusplus | 85 #ifdef __cplusplus |
| 87 } | 86 } |
| 88 #endif | 87 #endif |
| 89 | 88 |
| 90 #endif | 89 #endif |
| OLD | NEW |