Skip to content

Commit

Permalink
librados: init all variables in ctors
Browse files Browse the repository at this point in the history
C_aio_sparse_read_Ack's members are filled in by the only caller
immediately after construction, so make them arguments to the
constructor.

CID 717218: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "m" is not initialized in this
constructor nor in any functions that it calls.

WatchContext: these variables are unused, so remove them.

CID 717217: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member "ver" is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <[email protected]>
  • Loading branch information
jdurgin committed Sep 25, 2012
1 parent fa21924 commit 24ef2ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/librados/IoCtxImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,7 @@ int librados::IoCtxImpl::aio_sparse_read(const object_t oid,
if (len > (size_t) INT_MAX)
return -EDOM;

C_aio_sparse_read_Ack *onack = new C_aio_sparse_read_Ack(c);
onack->m = m;
onack->data_bl = data_bl;
C_aio_sparse_read_Ack *onack = new C_aio_sparse_read_Ack(c, data_bl, m);
eversion_t ver;

c->io = this;
Expand Down Expand Up @@ -1566,8 +1564,10 @@ void librados::IoCtxImpl::C_aio_Ack::finish(int r)

/////////////////////// C_aio_sparse_read_Ack //////////////////////////

librados::IoCtxImpl::C_aio_sparse_read_Ack::C_aio_sparse_read_Ack(AioCompletionImpl *_c)
: c(_c)
librados::IoCtxImpl::C_aio_sparse_read_Ack::C_aio_sparse_read_Ack(AioCompletionImpl *_c,
bufferlist *data,
std::map<uint64_t, uint64_t> *extents)
: c(_c), data_bl(data), m(extents)
{
c->get();
}
Expand Down
8 changes: 4 additions & 4 deletions src/librados/IoCtxImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ struct librados::IoCtxImpl {
struct C_aio_sparse_read_Ack : public Context {
AioCompletionImpl *c;
bufferlist *data_bl;
std::map<uint64_t,uint64_t> *m;
C_aio_sparse_read_Ack(AioCompletionImpl *_c);
std::map<uint64_t, uint64_t> *m;
C_aio_sparse_read_Ack(AioCompletionImpl *_c,
bufferlist *data,
std::map<uint64_t, uint64_t> *extents);
void finish(int r);
};

Expand Down Expand Up @@ -204,8 +206,6 @@ namespace librados {
struct WatchContext : public RefCountedWaitObject {
IoCtxImpl *io_ctx_impl;
const object_t oid;
uint64_t cookie;
uint64_t ver;
librados::WatchCtx *ctx;
uint64_t linger_id;

Expand Down

0 comments on commit 24ef2ef

Please sign in to comment.