summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f696543)
raw | patch | inline | side by side (parent: f696543)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Thu, 7 Jul 2011 04:23:55 +0000 (12:23 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 7 Jul 2011 16:36:44 +0000 (09:36 -0700) |
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>
performance advantage.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xprepare.c | patch | blob | history |
diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c
index 16890852350cb62bb9f9aec5e52eea8ba46f1192..783631a34c96b8cadb300b3c8c2c81ed42296237 100644 (file)
--- a/xdiff/xprepare.c
+++ b/xdiff/xprepare.c
static int xdl_init_classifier(xdlclassifier_t *cf, long size, long flags) {
- long i;
-
cf->flags = flags;
cf->hbits = xdl_hashbits((unsigned int) size);
xdl_cha_free(&cf->ncha);
return -1;
}
- for (i = 0; i < cf->hsize; i++)
- cf->rchash[i] = NULL;
+ memset(cf->rchash, 0, cf->hsize * sizeof(xdlclass_t *));
cf->count = 0;
static int xdl_prepare_ctx(mmfile_t *mf, long narec, xpparam_t const *xpp,
xdlclassifier_t *cf, xdfile_t *xdf) {
unsigned int hbits;
- long i, nrec, hsize, bsize;
+ long nrec, hsize, bsize;
unsigned long hav;
char const *blk, *cur, *top, *prev;
xrecord_t *crec;
xdl_cha_free(&xdf->rcha);
return -1;
}
- for (i = 0; i < hsize; i++)
- rhash[i] = NULL;
+ memset(rhash, 0, hsize * sizeof(xrecord_t *));
nrec = 0;
if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) {