From: Francesco Chemolli Date: Thu, 12 Jul 2012 09:08:16 +0000 (+0200) Subject: Changed increment/decrement operators from postfix to prefix form. X-Git-Tag: sourceformat-review-1~164^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb4185f12e40c95692012f6c0d3ff68995db116a;p=thirdparty%2Fsquid.git Changed increment/decrement operators from postfix to prefix form. --- diff --git a/src/DiskIO/AIO/AIODiskFile.cc b/src/DiskIO/AIO/AIODiskFile.cc index fafc127ff0..33abf93dd9 100644 --- a/src/DiskIO/AIO/AIODiskFile.cc +++ b/src/DiskIO/AIO/AIODiskFile.cc @@ -99,7 +99,7 @@ AIODiskFile::open(int flags, mode_t mode, RefCount callback) error(true); } else { closed = false; - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79, 3, HERE << ": opened FD " << fd); } @@ -159,7 +159,7 @@ AIODiskFile::read(ReadRequest *request) qe->aq_e_aiocb.aio_buf = request->buf; /* Account */ - strategy->aq.aq_numpending++; + ++ strategy->aq.aq_numpending; /* Initiate aio */ if (aio_read(&qe->aq_e_aiocb) < 0) { diff --git a/src/DiskIO/AIO/AIODiskIOStrategy.cc b/src/DiskIO/AIO/AIODiskIOStrategy.cc index 60847b4831..ef1777093d 100644 --- a/src/DiskIO/AIO/AIODiskIOStrategy.cc +++ b/src/DiskIO/AIO/AIODiskIOStrategy.cc @@ -136,7 +136,7 @@ AIODiskIOStrategy::callback() /* Loop through all slots */ - for (i = 0; i < MAX_ASYNCOP; i++) { + for (i = 0; i < MAX_ASYNCOP; ++i) { if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_USED) { aqe = &aq.aq_queue[i]; /* Active, get status */ @@ -223,7 +223,7 @@ AIODiskIOStrategy::findSlot() { /* Later we should use something a little more .. efficient :) */ - for (int i = 0; i < MAX_ASYNCOP; i++) { + for (int i = 0; i < MAX_ASYNCOP; ++i) { if (aq.aq_queue[i].aq_e_state == AQ_ENTRY_FREE) /* Found! */ return i; diff --git a/src/DiskIO/AIO/aio_win32.cc b/src/DiskIO/AIO/aio_win32.cc index 399854f083..728508dc0c 100644 --- a/src/DiskIO/AIO/aio_win32.cc +++ b/src/DiskIO/AIO/aio_win32.cc @@ -319,7 +319,7 @@ int aio_open(const char *path, int mode) FILE_FLAG_OVERLAPPED, /* file attributes */ NULL /* handle to template file */ )) != INVALID_HANDLE_VALUE) { - statCounter.syscalls.disk.opens++; + ++ statCounter.syscalls.disk.opens; fd = _open_osfhandle((long) hndl, 0); commSetCloseOnExec(fd); fd_open(fd, FD_FILE, path); @@ -336,7 +336,7 @@ void aio_close(int fd) { CloseHandle((HANDLE)_get_osfhandle(fd)); fd_close(fd); - statCounter.syscalls.disk.closes++; + ++ statCounter.syscalls.disk.closes; } diff --git a/src/DiskIO/Blocking/BlockingFile.cc b/src/DiskIO/Blocking/BlockingFile.cc index fd92024a48..229e977c0d 100644 --- a/src/DiskIO/Blocking/BlockingFile.cc +++ b/src/DiskIO/Blocking/BlockingFile.cc @@ -82,7 +82,7 @@ BlockingFile::open(int flags, mode_t mode, RefCount callback) error(true); } else { closed = false; - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79, 3, "BlockingFile::open: opened FD " << fd); } @@ -106,7 +106,7 @@ void BlockingFile::doClose() if (fd > -1) { closed = true; file_close(fd); - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; } } diff --git a/src/DiskIO/DiskDaemon/DiskdFile.cc b/src/DiskIO/DiskDaemon/DiskdFile.cc index af376dcb8c..9c56f723ac 100644 --- a/src/DiskIO/DiskDaemon/DiskdFile.cc +++ b/src/DiskIO/DiskDaemon/DiskdFile.cc @@ -112,7 +112,7 @@ DiskdFile::open(int flags, mode_t aMode, RefCount< IORequestor > callback) ioRequestor = NULL; } - diskd_stats.open.ops++; + ++diskd_stats.open.ops; } void @@ -145,7 +145,7 @@ DiskdFile::create(int flags, mode_t aMode, RefCount< IORequestor > callback) return; } - diskd_stats.create.ops++; + ++diskd_stats.create.ops; } void @@ -174,7 +174,7 @@ DiskdFile::read(ReadRequest *aRead) return; } - diskd_stats.read.ops++; + ++diskd_stats.read.ops; } void @@ -200,7 +200,7 @@ DiskdFile::close() return; } - diskd_stats.close.ops++; + ++diskd_stats.close.ops; } bool @@ -280,10 +280,10 @@ DiskdFile::openDone(diomsg *M) debugs(79, 3, "storeDiskdOpenDone: status " << M->status); if (M->status < 0) { - diskd_stats.open.fail++; + ++diskd_stats.open.fail; errorOccured = true; } else { - diskd_stats.open.success++; + ++diskd_stats.open.success; } ioCompleted(); @@ -297,10 +297,10 @@ DiskdFile::createDone(diomsg *M) debugs(79, 3, "storeDiskdCreateDone: status " << M->status); if (M->status < 0) { - diskd_stats.create.fail++; + ++diskd_stats.create.fail; errorOccured = true; } else { - diskd_stats.create.success++; + ++diskd_stats.create.success; } ioCompleted(); @@ -338,7 +338,7 @@ DiskdFile::write(WriteRequest *aRequest) return; } - diskd_stats.write.ops++; + ++diskd_stats.write.ops; } void @@ -360,10 +360,10 @@ DiskdFile::closeDone(diomsg * M) debugs(79, 3, "DiskdFile::closeDone: status " << M->status); if (M->status < 0) { - diskd_stats.close.fail++; + ++diskd_stats.close.fail; errorOccured = true; } else { - diskd_stats.close.success++; + ++diskd_stats.close.success; } ioCompleted(); @@ -385,14 +385,14 @@ DiskdFile::readDone(diomsg * M) readRequest->RefCountDereference(); if (M->status < 0) { - diskd_stats.read.fail++; + ++diskd_stats.read.fail; ioCompleted(); errorOccured = true; ioRequestor->readCompleted(NULL, -1, DISK_ERROR, readRequest); return; } - diskd_stats.read.success++; + ++diskd_stats.read.success; ioCompleted(); ioRequestor->readCompleted (IO->shm.buf + M->shm_offset, M->status, DISK_OK, readRequest); @@ -410,13 +410,13 @@ DiskdFile::writeDone(diomsg *M) if (M->status < 0) { errorOccured = true; - diskd_stats.write.fail++; + ++diskd_stats.write.fail; ioCompleted(); ioRequestor->writeCompleted (DISK_ERROR,0, writeRequest); return; } - diskd_stats.write.success++; + ++diskd_stats.write.success; ioCompleted(); ioRequestor->writeCompleted (DISK_OK,M->status, writeRequest); } diff --git a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc index 1c0b937e5b..1168bfea9e 100644 --- a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc +++ b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc @@ -87,7 +87,7 @@ DiskdIOStrategy::load() void DiskdIOStrategy::openFailed() { - diskd_stats.open_fail_queue_len++; + ++diskd_stats.open_fail_queue_len; } DiskFile::Pointer @@ -151,7 +151,7 @@ DiskdIOStrategy::unlinkFile(char const *path) // shm.put (shm_offset); } - diskd_stats.unlink.ops++; + ++diskd_stats.unlink.ops; } void @@ -238,7 +238,7 @@ SharedMemory::get(ssize_t * shm_offset) char *aBuf = NULL; int i; - for (i = 0; i < nbufs; i++) { + for (i = 0; i < nbufs; ++i) { if (CBIT_TEST(inuse_map, i)) continue; @@ -254,7 +254,7 @@ SharedMemory::get(ssize_t * shm_offset) assert(aBuf); assert(aBuf >= buf); assert(aBuf < buf + (nbufs * SHMBUF_BLKSZ)); - diskd_stats.shmbuf_count++; + ++diskd_stats.shmbuf_count; if (diskd_stats.max_shmuse < diskd_stats.shmbuf_count) diskd_stats.max_shmuse = diskd_stats.shmbuf_count; @@ -284,7 +284,7 @@ SharedMemory::init(int ikey, int magic2) inuse_map = (char *)xcalloc((nbufs + 7) / 8, 1); diskd_stats.shmbuf_count += nbufs; - for (int i = 0; i < nbufs; i++) { + for (int i = 0; i < nbufs; ++i) { CBIT_SET(inuse_map, i); put (i * SHMBUF_BLKSZ); } @@ -297,9 +297,9 @@ DiskdIOStrategy::unlinkDone(diomsg * M) ++statCounter.syscalls.disk.unlinks; if (M->status < 0) - diskd_stats.unlink.fail++; + ++diskd_stats.unlink.fail; else - diskd_stats.unlink.success++; + ++diskd_stats.unlink.success; } void @@ -400,8 +400,8 @@ DiskdIOStrategy::SEND(diomsg *M, int mtype, int id, size_t size, off_t offset, s last_seq_no = M->seq_no; if (0 == x) { - diskd_stats.sent_count++; - away++; + ++diskd_stats.sent_count; + ++away; } else { debugs(79, 1, "storeDiskdSend: msgsnd: " << xstrerror()); cbdataReferenceDone(M->callback_data); @@ -549,7 +549,7 @@ DiskdIOStrategy::callback() int retval = 0; if (away >= magic2) { - diskd_stats.block_queue_len++; + ++diskd_stats.block_queue_len; retval = 1; /* We might not have anything to do, but our queue * is full.. */ @@ -574,7 +574,7 @@ DiskdIOStrategy::callback() break; } - diskd_stats.recv_count++; + ++diskd_stats.recv_count; --away; handle(&M); retval = 1; /* Return that we've actually done some work */ diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc index 19cfc6222c..72a176806a 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc @@ -96,7 +96,7 @@ DiskThreadsDiskFile::open(int flags, mode_t mode, RefCount callback } #endif - Opening_FD++; + ++Opening_FD; ioRequestor = callback; @@ -145,7 +145,7 @@ DiskThreadsDiskFile::create(int flags, mode_t mode, RefCount callba } #endif - Opening_FD++; + ++Opening_FD; ioRequestor = callback; @@ -189,7 +189,7 @@ DiskThreadsDiskFile::openDone(int unused, const char *unused2, int anFD, int err debugs(79, 1, "\t" << path_); errorOccured = true; } else { - store_open_disk_fd++; + ++store_open_disk_fd; commSetCloseOnExec(fd); fd_open(fd, FD_FILE, path_); } diff --git a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc index e490f392c9..296e3f4ca2 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc @@ -94,7 +94,7 @@ DiskThreadsIOStrategy::callback() int retval = 0; assert(initialised); - squidaio_counts.check_callback++; + ++squidaio_counts.check_callback; for (;;) { if ((resultp = squidaio_poll_done()) == NULL) diff --git a/src/DiskIO/DiskThreads/aiops.cc b/src/DiskIO/DiskThreads/aiops.cc index b65c7ba35d..926dc76725 100644 --- a/src/DiskIO/DiskThreads/aiops.cc +++ b/src/DiskIO/DiskThreads/aiops.cc @@ -313,7 +313,7 @@ squidaio_init(void) assert(NUMTHREADS); - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc(); threadp->status = _THREAD_STARTING; threadp->current_req = NULL; @@ -473,7 +473,7 @@ squidaio_thread_loop(void *ptr) done_queue.tailp = &request->next; pthread_mutex_unlock(&done_queue.mutex); CommIO::NotifyIOCompleted(); - threadp->requests++; + ++ threadp->requests; } /* while forever */ return NULL; @@ -1040,7 +1040,7 @@ squidaio_stats(StoreEntry * sentry) threadp = threads; - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, (unsigned long)threadp->thread, threadp->requests); threadp = threadp->next; } diff --git a/src/DiskIO/DiskThreads/aiops_win32.cc b/src/DiskIO/DiskThreads/aiops_win32.cc index 60c007659b..3b54357adc 100644 --- a/src/DiskIO/DiskThreads/aiops_win32.cc +++ b/src/DiskIO/DiskThreads/aiops_win32.cc @@ -305,7 +305,7 @@ squidaio_init(void) assert(NUMTHREADS); - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc(); threadp->status = _THREAD_STARTING; threadp->current_req = NULL; @@ -364,7 +364,7 @@ squidaio_shutdown(void) threadp = threads; - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { threadp->exit = 1; hthreads[i] = threadp->thread; threadp = threadp->next; @@ -378,7 +378,7 @@ squidaio_shutdown(void) WaitForMultipleObjects(NUMTHREADS, hthreads, TRUE, 2000); - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { CloseHandle(hthreads[i]); } @@ -550,7 +550,7 @@ squidaio_thread_loop(LPVOID lpParam) CommIO::NotifyIOCompleted(); Sleep(0); - threadp->requests++; + ++ threadp->requests; } /* while forever */ CloseHandle(cond); @@ -1153,7 +1153,7 @@ squidaio_stats(StoreEntry * sentry) threadp = threads; - for (i = 0; i < NUMTHREADS; i++) { + for (i = 0; i < NUMTHREADS; ++i) { storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, threadp->dwThreadId, threadp->requests); threadp = threadp->next; } diff --git a/src/DiskIO/DiskThreads/async_io.cc b/src/DiskIO/DiskThreads/async_io.cc index f0f56a51cc..c8b3c65bf2 100644 --- a/src/DiskIO/DiskThreads/async_io.cc +++ b/src/DiskIO/DiskThreads/async_io.cc @@ -57,7 +57,7 @@ aioOpen(const char *path, int oflag, mode_t mode, AIOCB * callback, void *callba squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.open_start++; + ++squidaio_counts.open_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -75,7 +75,7 @@ aioClose(int fd) squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.close_start++; + ++squidaio_counts.close_start; aioCancel(fd); ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; @@ -95,7 +95,7 @@ aioCancel(int fd) dlink_node *m, *next; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.cancel++; + ++squidaio_counts.cancel; for (m = used_list.head; m; m = next) { next = m->next; @@ -137,7 +137,7 @@ aioWrite(int fd, off_t offset, char *bufp, size_t len, AIOCB * callback, void *c int seekmode; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.write_start++; + ++squidaio_counts.write_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = callback; @@ -166,7 +166,7 @@ aioRead(int fd, off_t offset, size_t len, AIOCB * callback, void *callback_data) int seekmode; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.read_start++; + ++squidaio_counts.read_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = fd; ctrlp->done_handler = callback; @@ -195,7 +195,7 @@ aioStat(char *path, struct stat *sb, AIOCB * callback, void *callback_data) squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.stat_start++; + ++squidaio_counts.stat_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; @@ -212,7 +212,7 @@ aioUnlink(const char *path, AIOCB * callback, void *callback_data) { squidaio_ctrl_t *ctrlp; assert(DiskThreadsIOStrategy::Instance.initialised); - squidaio_counts.unlink_start++; + ++squidaio_counts.unlink_start; ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc(); ctrlp->fd = -2; ctrlp->done_handler = callback; diff --git a/src/DiskIO/IpcIo/IpcIoFile.cc b/src/DiskIO/IpcIo/IpcIoFile.cc index 30f9c585f7..dffc15c297 100644 --- a/src/DiskIO/IpcIo/IpcIoFile.cc +++ b/src/DiskIO/IpcIo/IpcIoFile.cc @@ -835,7 +835,7 @@ DiskerOpen(const String &path, int flags, mode_t mode) return false; } - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79,3, HERE << "rock db opened " << path << ": FD " << TheFile); return true; } diff --git a/src/DiskIO/Mmapped/MmappedFile.cc b/src/DiskIO/Mmapped/MmappedFile.cc index 0b54105c6b..52309f1844 100644 --- a/src/DiskIO/Mmapped/MmappedFile.cc +++ b/src/DiskIO/Mmapped/MmappedFile.cc @@ -80,7 +80,7 @@ MmappedFile::open(int flags, mode_t mode, RefCount callback) debugs(79,3, HERE << "open error: " << xstrerror()); error_ = true; } else { - store_open_disk_fd++; + ++store_open_disk_fd; debugs(79,3, HERE << "FD " << fd); // setup mapping boundaries diff --git a/src/esi/Libxml2Parser.cc b/src/esi/Libxml2Parser.cc index 359849a904..b5427c297d 100644 --- a/src/esi/Libxml2Parser.cc +++ b/src/esi/Libxml2Parser.cc @@ -56,8 +56,8 @@ void esi_startElementSAXFunc(void * ctx, const xmlChar * name, const xmlChar ** xmlChar **tmp = (xmlChar **)atts; while (tmp && *tmp != NULL) { - count++; - tmp++; + ++count; + ++tmp; } // we increased on every key and value diff --git a/src/eui/Eui48.cc b/src/eui/Eui48.cc index bbd19646f8..91d86d9487 100644 --- a/src/eui/Eui48.cc +++ b/src/eui/Eui48.cc @@ -485,7 +485,7 @@ Eui::Eui48::lookup(const Ip::Address &c) } /* Find MAC address from net table */ - for (i = 0 ; i < NetTable->dwNumEntries ; i++) { + for (i = 0 ; i < NetTable->dwNumEntries ; ++i) { in_addr a; a.s_addr = NetTable->table[i].dwAddr; if (c == a && (NetTable->table[i].dwType > 2)) { diff --git a/src/format/Format.cc b/src/format/Format.cc index 18348e8148..bb8bed4bd2 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -263,30 +263,30 @@ log_quoted_string(const char *str, char *out) case '\r': *p++ = '\\'; *p++ = 'r'; - str++; + ++str; break; case '\n': *p++ = '\\'; *p++ = 'n'; - str++; + ++str; break; case '\t': *p++ = '\\'; *p++ = 't'; - str++; + ++str; break; default: *p++ = '\\'; *p++ = *str; - str++; + ++str; break; } } - *p++ = '\0'; + *p = '\0'; } void diff --git a/src/format/Token.cc b/src/format/Token.cc index 37c665f06b..522914328b 100644 --- a/src/format/Token.cc +++ b/src/format/Token.cc @@ -210,7 +210,7 @@ Format::Token::Init() char * Format::Token::scanForToken(TokenTableEntry const table[], char *cur) { - for (TokenTableEntry const *lte = table; lte->configTag != NULL; lte++) { + for (TokenTableEntry const *lte = table; lte->configTag != NULL; ++lte) { debugs(46, 8, HERE << "compare tokens '" << lte->configTag << "' with '" << cur << "'"); if (strncmp(lte->configTag, cur, strlen(lte->configTag)) == 0) { type = lte->tokenType; @@ -268,8 +268,8 @@ Format::Token::parse(char *def, Quoting *quoting) break; } - cur++; - l--; + ++cur; + --l; } goto done; @@ -278,29 +278,29 @@ Format::Token::parse(char *def, Quoting *quoting) if (!*cur) goto done; - cur++; + ++cur; // select quoting style for his particular token switch (*cur) { case '"': quote = LOG_QUOTE_QUOTES; - cur++; + ++cur; break; case '\'': quote = LOG_QUOTE_RAW; - cur++; + ++cur; break; case '[': quote = LOG_QUOTE_MIMEBLOB; - cur++; + ++cur; break; case '#': quote = LOG_QUOTE_URL; - cur++; + ++cur; break; default: @@ -310,12 +310,12 @@ Format::Token::parse(char *def, Quoting *quoting) if (*cur == '-') { left = 1; - cur++; + ++cur; } if (*cur == '0') { zero = 1; - cur++; + ++cur; } if (xisdigit(*cur)) @@ -326,7 +326,7 @@ Format::Token::parse(char *def, Quoting *quoting) if (*cur == '{') { char *cp; - cur++; + ++cur; l = strcspn(cur, "}"); cp = (char *)xmalloc(l + 1); xstrncpy(cp, cur, l + 1); @@ -334,14 +334,14 @@ Format::Token::parse(char *def, Quoting *quoting) cur += l; if (*cur == '}') - cur++; + ++cur; } type = LFT_NONE; // Scan each registered token namespace debugs(46, 9, HERE << "check for token in " << TheConfig.tokens.size() << " namespaces."); - for (std::list::const_iterator itr = TheConfig.tokens.begin(); itr != TheConfig.tokens.end(); itr++) { + for (std::list::const_iterator itr = TheConfig.tokens.begin(); itr != TheConfig.tokens.end(); ++itr) { debugs(46, 7, HERE << "check for possible " << itr->prefix << ":: token"); const size_t len = itr->prefix.size(); if (itr->prefix.cmp(cur, len) == 0 && cur[len] == ':' && cur[len+1] == ':') { @@ -386,7 +386,7 @@ Format::Token::parse(char *def, Quoting *quoting) if (*cur == ' ') { space = 1; - cur++; + ++cur; } done: @@ -499,7 +499,7 @@ done: int i; divisor = 1000000; - for (i = widthMax; i > 1; i--) + for (i = widthMax; i > 1; --i) divisor /= 10; if (!divisor) diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index e0a02f8b66..1e51d449ac 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -96,7 +96,7 @@ storeCossDirSwapLogFile(SwapDir * sd, const char *ext) while (strlen(pathtmp) && pathtmp[strlen(pathtmp) - 1] == '.') pathtmp[strlen(pathtmp) - 1] = '\0'; - for (pathtmp2 = pathtmp; *pathtmp2 == '.'; pathtmp2++); + for (pathtmp2 = pathtmp; *pathtmp2 == '.'; ++pathtmp2); snprintf(path, MAXPATHLEN - 64, Config.Log.swap, pathtmp2); if (strncmp(path, Config.Log.swap, MAXPATHLEN - 64) == 0) { @@ -174,7 +174,7 @@ CossSwapDir::readCompleted(const char *buf, int len, int errflag, RefCountflags.reading = 0; if (errflag) { - StoreFScoss::GetInstance().stats.read.fail++; + ++ StoreFScoss::GetInstance().stats.read.fail; if (errflag > 0) { errno = errflag; @@ -185,7 +185,7 @@ CossSwapDir::readCompleted(const char *buf, int len, int errflag, RefCountreadbuffer == NULL) { cstate->readbuffer = (char *)xmalloc(cstate->st_size); @@ -217,17 +217,17 @@ CossSwapDir::writeCompleted(int errflag, size_t len, RefCount writ if (errflag) { - StoreFScoss::GetInstance().stats.stripe_write.fail++; + ++ StoreFScoss::GetInstance().stats.stripe_write.fail; debugs(79, 1, "storeCossWriteMemBufDone: got failure (" << errflag << ")"); debugs(79, 1, "size=" << cossWrite->membuf->diskend - cossWrite->membuf->diskstart); } else { - StoreFScoss::GetInstance().stats.stripe_write.success++; + ++ StoreFScoss::GetInstance().stats.stripe_write.success; } dlinkDelete(&cossWrite->membuf->node, &membufs); cbdataFree(cossWrite->membuf); - StoreFScoss::GetInstance().stats.stripes--; + -- StoreFScoss::GetInstance().stats.stripes; } void @@ -368,7 +368,7 @@ storeCossRebuildComplete(void *data) RebuildState *rb = (RebuildState *)data; CossSwapDir *sd = rb->sd; sd->startMembuf(); - StoreController::store_dirs_rebuilding--; + -- StoreController::store_dirs_rebuilding; storeCossDirCloseTmpSwapLog(rb->sd); storeRebuildComplete(&rb->counts); cbdataFree(rb); @@ -385,7 +385,7 @@ storeCossRebuildFromSwapLog(void *data) assert(rb != NULL); /* load a number of objects per invocation */ - for (int aCount = 0; aCount < rb->speed; aCount++) { + for (int aCount = 0; aCount < rb->speed; ++aCount) { if (fread(&s, ss, 1, rb->log) != 1) { debugs(47, 1, "Done reading " << rb->sd->path << " swaplog (" << rb->n_read << " entries)"); fclose(rb->log); @@ -394,7 +394,7 @@ storeCossRebuildFromSwapLog(void *data) return; } - rb->n_read++; + ++ rb->n_read; if (s.op <= SWAP_LOG_NOP) continue; @@ -430,8 +430,8 @@ storeCossRebuildFromSwapLog(void *data) e->release(); /* Fake an unlink here, this is a bad hack :( */ storeCossRemove(rb->sd, e); - rb->counts.objcount--; - rb->counts.cancelcount++; + -- rb->counts.objcount; + ++ rb->counts.cancelcount; } continue; } else { @@ -441,7 +441,7 @@ storeCossRebuildFromSwapLog(void *data) (int) x) debugs(47, 1, "WARNING: " << rb->counts.bad_log_op << " invalid swap log entries found"); - rb->counts.invalid++; + ++ rb->counts.invalid; continue; } @@ -456,7 +456,7 @@ storeCossRebuildFromSwapLog(void *data) } if (EBIT_TEST(s.flags, KEY_PRIVATE)) { - rb->counts.badflags++; + ++ rb->counts.badflags; continue; } @@ -466,11 +466,11 @@ storeCossRebuildFromSwapLog(void *data) if (e) { /* key already exists, current entry is newer */ /* keep old, ignore new */ - rb->counts.dupcount++; + ++ rb->counts.dupcount; continue; } - rb->counts.objcount++; + ++ rb->counts.objcount; e = rb->sd->addDiskRestore(s.key, s.swap_filen, @@ -557,7 +557,7 @@ storeCossDirRebuild(CossSwapDir * sd) fp = storeCossDirOpenTmpSwapLog(sd, &clean, &zero); debugs(47, 1, "Rebuilding COSS storage in " << sd->path << " (" << (clean ? "CLEAN" : "DIRTY") << ")"); rb->log = fp; - StoreController::store_dirs_rebuilding++; + ++ StoreController::store_dirs_rebuilding; if (!clean || fp == NULL) { /* COSS cannot yet rebuild from a dirty state. If the log @@ -941,7 +941,7 @@ CossSwapDir::~CossSwapDir() closeLog(); - n_coss_dirs--; + --n_coss_dirs; safe_free(ioModule); @@ -1106,7 +1106,7 @@ CossSwapDir::optionBlockSizeParse(const char *option, const char *value, int rec int check = blksz; while (check > 1) { - nbits++; + ++nbits; check >>= 1; } diff --git a/src/fs/coss/store_io_coss.cc b/src/fs/coss/store_io_coss.cc index c19642469f..458f55d69a 100644 --- a/src/fs/coss/store_io_coss.cc +++ b/src/fs/coss/store_io_coss.cc @@ -71,10 +71,10 @@ CossSwapDir::allocate(const StoreEntry * e, int which) if (which == COSS_ALLOC_REALLOC) { checkf = e->swap_filen; - StoreFScoss::GetInstance().stats.alloc.realloc++; + ++ StoreFScoss::GetInstance().stats.alloc.realloc; } else { checkf = -1; - StoreFScoss::GetInstance().stats.alloc.alloc++; + ++ StoreFScoss::GetInstance().stats.alloc.alloc; } if (e->swap_file_sz > 0) @@ -88,7 +88,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which) * tried to allocate past the end of the disk, so wrap * back to the beginning */ - StoreFScoss::GetInstance().stats.disk_overflows++; + ++ StoreFScoss::GetInstance().stats.disk_overflows; current_membuf->flags.full = 1; current_membuf->diskend = current_offset; current_membuf->maybeWrite(this); @@ -103,7 +103,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which) /* * Skip the blank space at the end of the stripe. start over. */ - StoreFScoss::GetInstance().stats.stripe_overflows++; + ++ StoreFScoss::GetInstance().stats.stripe_overflows; current_membuf->flags.full = 1; current_offset = current_membuf->diskend; current_membuf->maybeWrite(this); @@ -123,7 +123,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which) current_offset = ((current_offset + blksz_mask) >> blksz_bits ) << blksz_bits; return storeCossDiskOffsetToFileno(retofs); } else { - StoreFScoss::GetInstance().stats.alloc.collisions++; + ++ StoreFScoss::GetInstance().stats.alloc.collisions; debugs(79, 3, "CossSwapDir::allocate: Collision"); return -1; } @@ -144,8 +144,8 @@ CossSwapDir::unlink(StoreEntry & e) cur_size -= fs.blksize * sizeInBlocks(e.swap_file_sz); --n_disk_objects; } - StoreFScoss::GetInstance().stats.unlink.ops++; - StoreFScoss::GetInstance().stats.unlink.success++; + ++ StoreFScoss::GetInstance().stats.unlink.ops; + ++ StoreFScoss::GetInstance().stats.unlink.success; storeCossRemove(this, &e); } @@ -163,7 +163,7 @@ CossSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, * the squid code is broken */ assert(e.mem_obj->object_sz != -1); - StoreFScoss::GetInstance().stats.create.ops++; + ++ StoreFScoss::GetInstance().stats.create.ops; /* * this one is kinda strange - Eric called allocate(), then @@ -194,7 +194,7 @@ CossSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, storeCossAdd(this, &e); cstate->lockMemBuf(); - StoreFScoss::GetInstance().stats.create.success++; + ++ StoreFScoss::GetInstance().stats.create.success; return sio; } @@ -207,7 +207,7 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback, sfileno f = e.swap_filen; debugs(79, 3, "storeCossOpen: offset " << f); - StoreFScoss::GetInstance().stats.open.ops++; + ++ StoreFScoss::GetInstance().stats.open.ops; StoreIOState::Pointer sio = new CossState (this); cstate = dynamic_cast(sio.getRaw()); @@ -232,14 +232,14 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback, if (p) { cstate->readbuffer = (char *)xmalloc(cstate->st_size); memcpy(cstate->readbuffer, p, cstate->st_size); - StoreFScoss::GetInstance().stats.open_mem_hits++; + ++ StoreFScoss::GetInstance().stats.open_mem_hits; } else { /* Do the allocation */ /* this is the first time we've been called on a new sio * read the whole object into memory, then return the * requested amount */ - StoreFScoss::GetInstance().stats.open_mem_misses++; + ++ StoreFScoss::GetInstance().stats.open_mem_misses; /* * This bit of code actually does the LRU disk thing - we realloc * a place for the object here, and the file_read() reads the object @@ -251,8 +251,8 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback, if (sio->swap_filen == -1) { /* We have to clean up neatly .. */ - StoreFScoss::GetInstance().stats.open.fail++; - numcollisions++; + ++ StoreFScoss::GetInstance().stats.open.fail; + ++numcollisions; debugs(79, 2, "storeCossOpen: Reallocation of " << e.swap_dirn << "/" << e.swap_filen << " failed"); /* XXX XXX XXX Will squid call storeUnlink for this object? */ return NULL; @@ -281,7 +281,7 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback, */ } - StoreFScoss::GetInstance().stats.open.success++; + ++ StoreFScoss::GetInstance().stats.open.success; return sio; } @@ -291,8 +291,8 @@ CossState::close(int) { debugs(79, 3, "storeCossClose: offset " << swap_filen); - StoreFScoss::GetInstance().stats.close.ops++; - StoreFScoss::GetInstance().stats.close.success++; + ++ StoreFScoss::GetInstance().stats.close.ops; + ++ StoreFScoss::GetInstance().stats.close.success; SD->storeCossMemBufUnlock(this); doCallback(0); } @@ -303,7 +303,7 @@ CossState::read_(char *buf, size_t size, off_t offset, STRCB * callback, void *c char *p; CossSwapDir *SD = (CossSwapDir *)INDEXSD(swap_dirn); - StoreFScoss::GetInstance().stats.read.ops++; + ++ StoreFScoss::GetInstance().stats.read.ops; assert(read.callback == NULL); assert(read.callback_data == NULL); read.callback = callback; @@ -348,7 +348,7 @@ CossState::write(char const *buf, size_t size, off_t offset, FREE * free_func) * the squid code is broken */ assert(e->mem_obj->object_sz != -1); - StoreFScoss::GetInstance().stats.write.ops++; + ++ StoreFScoss::GetInstance().stats.write.ops; debugs(79, 3, "storeCossWrite: offset " << offset_ << ", len " << (unsigned long int) size); diskoffset = SD->storeCossFilenoToDiskOffset(swap_filen) + offset_; @@ -361,7 +361,7 @@ CossState::write(char const *buf, size_t size, off_t offset, FREE * free_func) if (free_func) (free_func) ((char *)buf); - StoreFScoss::GetInstance().stats.write.success++; + ++ StoreFScoss::GetInstance().stats.write.success; } off_t @@ -484,7 +484,7 @@ CossSwapDir::storeCossMemBufUnlock(StoreIOState::Pointer sio) debugs(79, 3, "storeCossMemBufUnlock: unlocking " << t << ", lockcount " << t->lockcount); - t->lockcount--; + -- t->lockcount; cstate->locked_membuf = NULL; @@ -542,7 +542,7 @@ CossMemBuf::maybeWrite(CossSwapDir * SD) void CossMemBuf::write(CossSwapDir * SD) { - StoreFScoss::GetInstance().stats.stripe_write.ops++; + ++ StoreFScoss::GetInstance().stats.stripe_write.ops; debugs(79, 3, "CossMemBuf::write: offset " << diskstart << ", len " << (diskend - diskstart)); flags.writing = 1; /* XXX Remember that diskstart/diskend are block offsets! */ @@ -594,7 +594,7 @@ CossSwapDir::createMemBuf(off_t start, sfileno curfn, int *collision) if ((o >= (off_t)newmb->diskstart) && (o < (off_t)newmb->diskend)) { e->release(); - numreleased++; + ++numreleased; } else break; } @@ -602,7 +602,7 @@ CossSwapDir::createMemBuf(off_t start, sfileno curfn, int *collision) if (numreleased > 0) debugs(79, 3, "CossSwapDir::createMemBuf: this allocation released " << numreleased << " storeEntries"); - StoreFScoss::GetInstance().stats.stripes++; + ++ StoreFScoss::GetInstance().stats.stripes; return newmb; } diff --git a/src/fs/rock/RockRebuild.cc b/src/fs/rock/RockRebuild.cc index 94eea98707..552abb81f2 100644 --- a/src/fs/rock/RockRebuild.cc +++ b/src/fs/rock/RockRebuild.cc @@ -143,7 +143,7 @@ Rock::Rebuild::doOneEntry() if (buf.contentSize() < static_cast(sizeof(header))) { debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " << "Ignoring truncated cache entry meta data at " << dbOffset); - counts.invalid++; + ++counts.invalid; return; } memcpy(&header, buf.content(), sizeof(header)); @@ -151,7 +151,7 @@ Rock::Rebuild::doOneEntry() if (!header.sane()) { debugs(47, DBG_IMPORTANT, "WARNING: cache_dir[" << sd->index << "]: " << "Ignoring malformed cache entry meta data at " << dbOffset); - counts.invalid++; + ++counts.invalid; return; } buf.consume(sizeof(header)); // optimize to avoid memmove() @@ -161,7 +161,7 @@ Rock::Rebuild::doOneEntry() if (!storeRebuildParseEntry(buf, loadedE, key, counts, header.payloadSize)) { // skip empty slots if (loadedE.swap_filen > 0 || loadedE.swap_file_sz > 0) { - counts.invalid++; + ++counts.invalid; //sd->unlink(filen); leave garbage on disk, it should not hurt } return; @@ -171,7 +171,7 @@ Rock::Rebuild::doOneEntry() if (!storeRebuildKeepEntry(loadedE, key, counts)) return; - counts.objcount++; + ++counts.objcount; // loadedE->dump(5); sd->addEntry(filen, header, loadedE); diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 96a0cfa2c2..ecb8fac49c 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -395,7 +395,7 @@ UFSSwapDir::maintain() if (!e) break; /* no more objects */ - removed++; + ++removed; e->release(); } @@ -557,7 +557,7 @@ UFSSwapDir::verifyCacheDirs() if (!pathIsDirectory(path)) return true; - for (int j = 0; j < l1; j++) { + for (int j = 0; j < l1; ++j) { char const *aPath = swapSubDir(j); if (!pathIsDirectory(aPath)) @@ -572,7 +572,7 @@ UFSSwapDir::createSwapSubDirs() { LOCAL_ARRAY(char, name, MAXPATHLEN); - for (int i = 0; i < l1; i++) { + for (int i = 0; i < l1; ++i) { snprintf(name, MAXPATHLEN, "%s/%02X", path, i); int should_exist; @@ -584,7 +584,7 @@ UFSSwapDir::createSwapSubDirs() debugs(47, 1, "Making directories in " << name); - for (int k = 0; k < l2; k++) { + for (int k = 0; k < l2; ++k) { snprintf(name, MAXPATHLEN, "%s/%02X/%02X", path, i, k); createDirectory(name, should_exist); } @@ -609,7 +609,7 @@ UFSSwapDir::logFile(char const *ext) const while (strlen(pathtmp) && pathtmp[strlen(pathtmp) - 1] == '.') pathtmp[strlen(pathtmp) - 1] = '\0'; - for (pathtmp2 = pathtmp; *pathtmp2 == '.'; pathtmp2++); + for (pathtmp2 = pathtmp; *pathtmp2 == '.'; ++pathtmp2); snprintf(lpath, MAXPATHLEN - 64, Config.Log.swap, pathtmp2); if (strncmp(lpath, Config.Log.swap, MAXPATHLEN - 64) == 0) { @@ -1145,7 +1145,7 @@ UFSSwapDir::DirClean(int swap_index) if (k > 10) k = 10; - for (n = 0; n < k; n++) { + for (n = 0; n < k; ++n) { debugs(36, 3, "storeDirClean: Cleaning file "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << files[n]); snprintf(p2, MAXPATHLEN + 1, "%s/%08X", p1, files[n]); safeunlink(p2, 0); @@ -1177,7 +1177,7 @@ UFSSwapDir::CleanEvent(void *unused) */ UFSDirToGlobalDirMapping = (int *)xcalloc(NumberOfUFSDirs, sizeof(*UFSDirToGlobalDirMapping)); - for (i = 0, n = 0; i < Config.cacheSwap.n_configured; i++) { + for (i = 0, n = 0; i < Config.cacheSwap.n_configured; ++i) { /* This is bogus, the controller should just clean each instance once */ sd = dynamic_cast (INDEXSD(i)); @@ -1205,7 +1205,7 @@ UFSSwapDir::CleanEvent(void *unused) /* if the rebuild is finished, start cleaning directories. */ if (0 == StoreController::store_dirs_rebuilding) { n = DirClean(swap_index); - swap_index++; + ++swap_index; } eventAdd("storeDirClean", CleanEvent, NULL, diff --git a/src/fs/ufs/ufscommon.cc b/src/fs/ufs/ufscommon.cc index 266715e7f5..b329f96cc6 100644 --- a/src/fs/ufs/ufscommon.cc +++ b/src/fs/ufs/ufscommon.cc @@ -386,7 +386,7 @@ RebuildState::RebuildStep(void *data) if (!rb->isDone()) eventAdd("storeRebuild", RebuildStep, rb, 0.01, 1); else { - StoreController::store_dirs_rebuilding--; + -- StoreController::store_dirs_rebuilding; storeRebuildComplete(&rb->counts); delete rb; } @@ -457,12 +457,12 @@ RebuildState::rebuildFromDirectory() assert(fd > -1); /* lets get file stats here */ - n_read++; + ++n_read; if (fstat(fd, &sb) < 0) { debugs(47, 1, "commonUfsDirRebuildFromDirectory: fstat(FD " << fd << "): " << xstrerror()); file_close(fd); - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; return; } @@ -477,7 +477,7 @@ RebuildState::rebuildFromDirectory() (int64_t)sb.st_size); file_close(fd); - store_open_disk_fd--; + --store_open_disk_fd; fd = -1; if (!loaded) { @@ -489,7 +489,7 @@ RebuildState::rebuildFromDirectory() if (!storeRebuildKeepEntry(tmpe, key, counts)) return; - counts.objcount++; + ++counts.objcount; // tmpe.dump(5); currentEntry(sd->addDiskRestore(key, filn, @@ -531,10 +531,10 @@ RebuildState::rebuildFromSwapLog() return; } - n_read++; + ++n_read; if (!swapData.sane()) { - counts.invalid++; + ++counts.invalid; return; } @@ -586,8 +586,8 @@ RebuildState::rebuildFromSwapLog() } currentEntry()->release(); - counts.objcount--; - counts.cancelcount++; + --counts.objcount; + ++counts.cancelcount; } return; } else { @@ -597,7 +597,7 @@ RebuildState::rebuildFromSwapLog() if (0.0 == x - (double) (int) x) debugs(47, 1, "WARNING: " << counts.bad_log_op << " invalid swap log entries found"); - counts.invalid++; + ++counts.invalid; return; } @@ -605,12 +605,12 @@ RebuildState::rebuildFromSwapLog() ++counts.scancount; // XXX: should not this be incremented earlier? if (!sd->validFileno(swapData.swap_filen, 0)) { - counts.invalid++; + ++counts.invalid; return; } if (EBIT_TEST(swapData.flags, KEY_PRIVATE)) { - counts.badflags++; + ++counts.badflags; return; } @@ -634,7 +634,7 @@ RebuildState::rebuildFromSwapLog() if (used && !disk_entry_newer) { /* log entry is old, ignore it */ - counts.clashcount++; + ++counts.clashcount; return; } else if (used && currentEntry() && currentEntry()->swap_filen == swapData.swap_filen && currentEntry()->swap_dirn == sd->index) { /* swapfile taken, same URL, newer, update meta */ @@ -672,12 +672,12 @@ RebuildState::rebuildFromSwapLog() * were in a slow rebuild and the the swap file number got taken * and the validation procedure hasn't run. */ assert(flags.need_to_validate); - counts.clashcount++; + ++counts.clashcount; return; } else if (currentEntry() && !disk_entry_newer) { /* key already exists, current entry is newer */ /* keep old, ignore new */ - counts.dupcount++; + ++counts.dupcount; return; } else if (currentEntry()) { /* key already exists, this swapfile not being used */ @@ -695,14 +695,14 @@ RebuildState::rebuildFromSwapLog() } currentEntry()->release(); - counts.dupcount++; + ++counts.dupcount; } else { /* URL doesnt exist, swapfile not in use */ /* load new */ (void) 0; } - counts.objcount++; + ++counts.objcount; currentEntry(sd->addDiskRestore(swapData.key, swapData.swap_filen, @@ -753,7 +753,7 @@ RebuildState::getNextFile(sfileno * filn_p, int *size) td = opendir(fullpath); - dirs_opened++; + ++dirs_opened; if (td == NULL) { debugs(47, 1, "commonUfsDirGetNextFile: opendir: " << fullpath << ": " << xstrerror()); @@ -768,7 +768,7 @@ RebuildState::getNextFile(sfileno * filn_p, int *size) } if (td != NULL && (entry = readdir(td)) != NULL) { - in_dir++; + ++in_dir; if (sscanf(entry->d_name, "%x", &fn) != 1) { debugs(47, 3, "commonUfsDirGetNextFile: invalid " << entry->d_name); @@ -797,7 +797,7 @@ RebuildState::getNextFile(sfileno * filn_p, int *size) if (fd < 0) debugs(47, 1, "commonUfsDirGetNextFile: " << fullfilename << ": " << xstrerror()); else - store_open_disk_fd++; + ++store_open_disk_fd; continue; }