xdiff/xprepare: use memset()
Use memset() instead of a for loop to initialize. This could give a performance advantage. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f696543dad
commit
452f4fa51e
@ -64,8 +64,6 @@ static int xdl_optimize_ctxs(xdfile_t *xdf1, xdfile_t *xdf2);
|
|||||||
|
|
||||||
|
|
||||||
static int xdl_init_classifier(xdlclassifier_t *cf, long size, long flags) {
|
static int xdl_init_classifier(xdlclassifier_t *cf, long size, long flags) {
|
||||||
long i;
|
|
||||||
|
|
||||||
cf->flags = flags;
|
cf->flags = flags;
|
||||||
|
|
||||||
cf->hbits = xdl_hashbits((unsigned int) size);
|
cf->hbits = xdl_hashbits((unsigned int) size);
|
||||||
@ -80,8 +78,7 @@ static int xdl_init_classifier(xdlclassifier_t *cf, long size, long flags) {
|
|||||||
xdl_cha_free(&cf->ncha);
|
xdl_cha_free(&cf->ncha);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < cf->hsize; i++)
|
memset(cf->rchash, 0, cf->hsize * sizeof(xdlclass_t *));
|
||||||
cf->rchash[i] = NULL;
|
|
||||||
|
|
||||||
cf->count = 0;
|
cf->count = 0;
|
||||||
|
|
||||||
@ -136,7 +133,7 @@ static int xdl_classify_record(xdlclassifier_t *cf, xrecord_t **rhash, unsigned
|
|||||||
static int xdl_prepare_ctx(mmfile_t *mf, long narec, xpparam_t const *xpp,
|
static int xdl_prepare_ctx(mmfile_t *mf, long narec, xpparam_t const *xpp,
|
||||||
xdlclassifier_t *cf, xdfile_t *xdf) {
|
xdlclassifier_t *cf, xdfile_t *xdf) {
|
||||||
unsigned int hbits;
|
unsigned int hbits;
|
||||||
long i, nrec, hsize, bsize;
|
long nrec, hsize, bsize;
|
||||||
unsigned long hav;
|
unsigned long hav;
|
||||||
char const *blk, *cur, *top, *prev;
|
char const *blk, *cur, *top, *prev;
|
||||||
xrecord_t *crec;
|
xrecord_t *crec;
|
||||||
@ -164,8 +161,7 @@ static int xdl_prepare_ctx(mmfile_t *mf, long narec, xpparam_t const *xpp,
|
|||||||
xdl_cha_free(&xdf->rcha);
|
xdl_cha_free(&xdf->rcha);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < hsize; i++)
|
memset(rhash, 0, hsize * sizeof(xrecord_t *));
|
||||||
rhash[i] = NULL;
|
|
||||||
|
|
||||||
nrec = 0;
|
nrec = 0;
|
||||||
if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) {
|
if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user