From: Davin McCall Date: Sat, 10 Feb 2018 15:53:35 +0000 (+0000) Subject: Renaming: camelCase to snake_case. X-Git-Tag: v0.1.0~33 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d680925b1c189b81248ab5ac3c407fcc184e5f6e;p=oweals%2Fdinit.git Renaming: camelCase to snake_case. --- diff --git a/src/control.cc b/src/control.cc index e285e2b..a804b51 100644 --- a/src/control.cc +++ b/src/control.cc @@ -295,12 +295,12 @@ control_conn_t::handle_t control_conn_t::allocate_service_handle(service_record // Try to find a unique handle (integer) in a single pass. Since the map is ordered, we can search until // we find a gap in the handle values. handle_t candidate = 0; - for (auto p : keyServiceMap) { + for (auto p : key_service_map) { if (p.first == candidate) candidate++; else break; } - bool is_unique = (serviceKeyMap.find(record) == serviceKeyMap.end()); + bool is_unique = (service_key_map.find(record) == service_key_map.end()); // The following operations perform allocation (can throw std::bad_alloc). If an exception occurs we // must undo any previous actions: @@ -309,15 +309,15 @@ control_conn_t::handle_t control_conn_t::allocate_service_handle(service_record } try { - keyServiceMap[candidate] = record; - serviceKeyMap.insert(std::make_pair(record, candidate)); + key_service_map[candidate] = record; + service_key_map.insert(std::make_pair(record, candidate)); } catch (...) { if (is_unique) { record->remove_listener(this); } - keyServiceMap.erase(candidate); + key_service_map.erase(candidate); } return candidate; @@ -531,7 +531,7 @@ control_conn_t::~control_conn_t() noexcept iob.deregister(loop); // Clear service listeners - for (auto p : serviceKeyMap) { + for (auto p : service_key_map) { p.first->remove_listener(this); } diff --git a/src/includes/control.h b/src/includes/control.h index e2aa1df..bbbda52 100644 --- a/src/includes/control.h +++ b/src/includes/control.h @@ -104,8 +104,8 @@ class control_conn_t : private service_listener // A mapping between service records and their associated numerical identifier used // in communction using handle_t = uint32_t; - std::unordered_multimap serviceKeyMap; - std::map keyServiceMap; + std::unordered_multimap service_key_map; + std::map key_service_map; // Buffer for outgoing packets. Each outgoing back is represented as a vector. list> outbuf; @@ -155,7 +155,7 @@ class control_conn_t : private service_listener service_record *find_service_for_key(uint32_t key) { try { - return keyServiceMap.at(key); + return key_service_map.at(key); } catch (std::out_of_range &exc) { return nullptr; @@ -176,7 +176,7 @@ class control_conn_t : private service_listener void service_event(service_record * service, service_event_t event) noexcept final override { // For each service handle corresponding to the event, send an information packet. - auto range = serviceKeyMap.equal_range(service); + auto range = service_key_map.equal_range(service); auto & i = range.first; auto & end = range.second; try {