diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2014-10-26 22:51:31 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2014-10-26 22:51:31 -0500 |
commit | 1e3548b039bd6b760ca3fe716c98065735110f58 (patch) | |
tree | b166346e9dc4713267cb3c32bc03b097cf2e1671 /common.h | |
parent | 8d551968f73d26413083bd42fc654a381d33352f (diff) |
Fix buffer distribution step
If there are no sorted elements to distribute the buffer into, we're done.
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -46,7 +46,7 @@ static void rotate(char *base, size_t size, size_t shift) static void distribute_buffer(char *base, size_t bufnmel, size_t sortnmel, size_t width, cmpfun cmp) { - while (bufnmel) { + while (bufnmel && sortnmel) { char *sorted = base + bufnmel * width; size_t insertpos = binary_search(base, sorted, sortnmel, width, cmp); if (insertpos > 0) { |