On Fri, Aug 26, 2011 at 11:51 AM, Christian Brunner <chb@xxxxxx> wrote: > +static int hash_read_cb(uint64_t ofs, size_t len, const char *buf, void *arg) > +{ > + ceph::crypto::Digest *Hash = (ceph::crypto::Digest *)arg; > + byte *hashbuf = (byte *) buf; Looking at it again, hashbuf is pretty much useless, you can use buf directly. > + byte *tempbuf = NULL; > + > + if (!buf) { > + len = ofs-lastofs; Why setting len here? len was already passed in. > + tempbuf = (byte *) malloc(len); > + if (!tempbuf) > + return -ENOMEM; > + hashbuf = tempbuf; buf = tempbuf; > + } > + Hash->Update((const byte *) hashbuf, len); > + > + lastofs = ofs + len; you don't need lastofs either. > + > + free(tempbuf); > + > + return 0; > +} > + -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html