]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Changing 'int const' to 'const int' 16825/head
authoramitkuma <amitkuma@redhat.com>
Fri, 4 Aug 2017 21:58:21 +0000 (03:28 +0530)
committeramitkuma <amitkuma@redhat.com>
Fri, 4 Aug 2017 21:58:21 +0000 (03:28 +0530)
As per coding Guidelines 'const int' is recommended over 'int const'
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md

NL.26: Use conventional const notation
Example:
const int x = 7;    // OK
int const y = 9;    // bad

Note
We are well aware that you could claim the "bad" examples more logical than the ones marked "OK", but they also confuse more people, especially novices relying on teaching material using the far more common, conventional OK style.
As ever, remember that the aim of these naming and layout rules is consistency and that aesthetics vary immensely.

Enforcement
Flag const used as a suffix for a type.

Signed-off-by: Amit Kumar amitkuma@redhat.com
src/cls/lua/cls_lua.cc
src/crush/CrushWrapper.h
src/mds/MDLog.cc
src/mds/SessionMap.cc
src/mds/SessionMap.h
src/mon/MDSMonitor.cc
src/osd/OSDMap.cc
src/osdc/Objecter.cc
src/tools/cephfs/Dumper.cc
src/tools/cephfs/JournalScanner.h

index 5cb5bc80ebb3e24d5f7a4bb7f191704a32ee84bc..3c84570c5dfbf4b3108161d898473aed8bffadca 100644 (file)
@@ -643,7 +643,7 @@ static const luaL_Reg clslua_lib[] = {
 };
 
 /*
- * Set int const in table at top of stack
+ * Set const int in table at top of stack
  */
 #define SET_INT_CONST(var) do { \
   lua_pushinteger(L, var); \
index a4b86c23229e457f2b6fdeffbc23211b397e2f9e..545553b795f1374a331d65b4777011ce5608b740 100644 (file)
@@ -1262,7 +1262,7 @@ public:
     }
   }
 
-  bool ruleset_exists(int const ruleset) const {
+  bool ruleset_exists(const int ruleset) const {
     for (size_t i = 0; i < crush->max_rules; ++i) {
       if (rule_exists(i) && crush->rules[i]->mask.ruleset == ruleset) {
        return true;
index b77c013b14a6ddedcdabc16b2e5988d8163b94c5..cb1f9b558b24c7ad98a70334f14ca4115d369029 100644 (file)
@@ -905,7 +905,7 @@ void MDLog::_recovery_thread(MDSInternalContextBase *completion)
   // If the pointer object is not present, then create it with
   // front = default ino and back = null
   JournalPointer jp(mds->get_nodeid(), mds->mdsmap->get_metadata_pool());
-  int const read_result = jp.load(mds->objecter);
+  const int read_result = jp.load(mds->objecter);
   if (read_result == -ENOENT) {
     inodeno_t const default_log_ino = MDS_INO_LOG_OFFSET + mds->get_nodeid();
     jp.front = default_log_ino;
index 561f2db9e8dc5fe8e0eaf321f7c8a6c493d2f2af..3057ba577b13e497dcabda0959ed2978e85299ec 100644 (file)
@@ -826,7 +826,7 @@ void Session::notify_cap_release(size_t n_caps)
  * in order to generate health metrics if the session doesn't see
  * a commensurate number of calls to ::notify_cap_release
  */
-void Session::notify_recall_sent(int const new_limit)
+void Session::notify_recall_sent(const int new_limit)
 {
   if (recalled_at.is_zero()) {
     // Entering recall phase, set up counters so we can later
index f96d00ab275077c6a07115d01493b51265394356..ebd4921cafb41b42702297b570acca835994b6bd 100644 (file)
@@ -148,7 +148,7 @@ public:
   interval_set<inodeno_t> pending_prealloc_inos; // journaling prealloc, will be added to prealloc_inos
 
   void notify_cap_release(size_t n_caps);
-  void notify_recall_sent(int const new_limit);
+  void notify_recall_sent(const int new_limit);
   void clear_recalled_at();
 
   inodeno_t next_ino() const {
index 7c6995947c8cdec44d59761121ac8c78559359f8..9d0b50d18cfbada9920b38178b048c4c82921e4b 100644 (file)
@@ -202,7 +202,7 @@ void MDSMonitor::encode_pending(MonitorDBStore::TransactionRef t)
       health.decode(bl_i);
     }
     for (const auto &metric : health.metrics) {
-      int const rank = info.rank;
+      const int rank = info.rank;
       health_check_t *check = &new_checks.get_or_add(
        mds_metric_name(metric.type),
        metric.sev,
@@ -850,7 +850,7 @@ void MDSMonitor::get_health(list<pair<health_status_t, string> >& summary,
     health.decode(bl_i);
 
     for (const auto &metric : health.metrics) {
-      int const rank = info.rank;
+      const int rank = info.rank;
       std::ostringstream message;
       message << "mds" << rank << ": " << metric.message;
       summary.push_back(std::make_pair(metric.sev, message.str()));
index 57035c4c8ea8e704597a7afeb75a905b562e5e6c..718c69223ef3fba021eab2e3078c2841cc444f87 100644 (file)
@@ -3311,7 +3311,7 @@ int OSDMap::build_simple_optioned(CephContext *cct, epoch_t e, uuid_d &fsid,
 
   int poolbase = get_max_osd() ? get_max_osd() : 1;
 
-  int const default_replicated_rule = crush->get_osd_pool_default_crush_replicated_ruleset(cct);
+  const int default_replicated_rule = crush->get_osd_pool_default_crush_replicated_ruleset(cct);
   assert(default_replicated_rule >= 0);
 
   if (default_pool) {
index b91cf4385a7b9f86dbd9064e06c57b7455a4e199..99f8842a017868d140ae41fa01962729f9475719 100644 (file)
@@ -1326,7 +1326,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
     if (!op->session) {
       _calc_target(&op->target, nullptr);
       OSDSession *s = NULL;
-      int const r = _get_session(op->target.osd, &s, sul);
+      const int r = _get_session(op->target.osd, &s, sul);
       assert(r == 0);
       assert(s != NULL);
       op->session = s;
index 73054c335ff4520f5d72d93748709334829b1c01..9c94a7d1442c169b96e2645ff53108e994075131 100644 (file)
@@ -63,7 +63,7 @@ int Dumper::recover_journal(Journaler *journaler)
   lock.Lock();
   journaler->recover(&cond);
   lock.Unlock();
-  int const r = cond.wait();
+  const int r = cond.wait();
 
   if (r < 0) { // Error
     derr << "error on recovery: " << cpp_strerror(r) << dendl;
index eb0218df294d63c91f06988881265c76dda2acf7..e6aaa05e11e24349b981f077e28084dddbcce5ec 100644 (file)
@@ -35,7 +35,7 @@ class JournalScanner
   librados::IoCtx &io;
 
   // Input constraints
-  int const rank;
+  const int rank;
   JournalFilter const filter;
 
   void gap_advance();