Commit 0344ea4a authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Try using an auto variable where a malloc was used in the smooth fun

git-svn-id: file:///svn/tokudb@91 c7de825b-a66e-492c-adef-691d508d4ae1
parent e323d20a
......@@ -9,7 +9,7 @@ DTOOL = valgrind --quiet --error-exitcode=1
default: bins
BINS = pma-test brt-test cachetable-test brt-serialize-test randbrt randdb4 hashtest ybt-test
BINS = pma-test brt-test cachetable-test brt-serialize-test randbrt randdb4 hashtest ybt-test benchmark-test
bins: $(BINS)
check: bins
$(DTOOL) ./ybt-test
......
......@@ -221,11 +221,15 @@ int pmainternal_smooth_region (struct kv_pair *pairs[], int n, int idx, int base
}
n_present++; // Save one for the blank guy.
{
struct kv_pair_tag *tmppairs;
//#define USE_MALLOC_IN_SMOOTH
#ifdef USE_MALLOC_IN_SMOOTH
struct kv_pair_tag *MALLOC_N(n_present, tmppairs);
#else
struct kv_pair_tag tmppairs[n_present];
#endif
int n_saved=0;
int r;
tmppairs = toku_malloc(n_present * sizeof (struct kv_pair_tag));
for (i=0; i<n; i++) {
if (i==idx) {
tmppairs[n_saved++].pair = 0;
......@@ -256,7 +260,9 @@ int pmainternal_smooth_region (struct kv_pair *pairs[], int n, int idx, int base
list_push(&pma->cursors, list);
}
}
#ifdef USE_MALLOC_IN_SMOOTH
toku_free(tmppairs);
#endif
return r;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment