Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: device/udev_linux/udev.cc

Issue 1018593002: Introduce UdevDeviceGetSysattrValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Omit device:: in udev.cc for local functions Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/udev_linux/udev.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/udev_linux/udev.cc
diff --git a/device/udev_linux/udev.cc b/device/udev_linux/udev.cc
index 65686dade2af5c26d8bae4f34b6bee01af4412a2..e2b93d2751667eaa61e559c038674ad1d234d913 100644
--- a/device/udev_linux/udev.cc
+++ b/device/udev_linux/udev.cc
@@ -9,6 +9,14 @@
namespace device {
+namespace {
+
+std::string StringOrEmptyIfNull(const char* value) {
+ return value ? value : std::string();
+}
+
+} // namespace
+
const char* udev_device_get_action(udev_device* udev_device) {
return UdevLoader::Get()->udev_device_get_action(udev_device);
}
@@ -149,8 +157,12 @@ void udev_unref(udev* udev) {
std::string UdevDeviceGetPropertyValue(udev_device* udev_device,
const char* key) {
- const char* value = device::udev_device_get_property_value(udev_device, key);
- return value ? value : std::string();
+ return StringOrEmptyIfNull(udev_device_get_property_value(udev_device, key));
+}
+
+std::string UdevDeviceGetSysattrValue(udev_device* udev_device,
+ const char* key) {
+ return StringOrEmptyIfNull(udev_device_get_sysattr_value(udev_device, key));
}
std::string UdevDecodeString(const std::string& encoded) {
« no previous file with comments | « device/udev_linux/udev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698