You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/09/02 21:16:41 UTC
[lucy-commits] [10/15] git commit: refs/heads/cfish-string-prep1 - Convert
TestSortSpec to CharBuf
Convert TestSortSpec to CharBuf
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0f0ec865
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0f0ec865
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0f0ec865
Branch: refs/heads/cfish-string-prep1
Commit: 0f0ec865e25d0ff553c616aa529456759ea262e6
Parents: f028d09
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Sep 2 20:17:31 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Sep 2 21:12:30 2013 +0200
----------------------------------------------------------------------
core/Lucy/Test/Search/TestSortSpec.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/0f0ec865/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 3961a5e..ead2c3f 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -28,6 +28,7 @@
#include "Lucy/Test/TestUtils.h"
#include "Lucy/Search/SortSpec.h"
+#include "Clownfish/CharBuf.h"
#include "Lucy/Analysis/StandardTokenizer.h"
#include "Lucy/Document/Doc.h"
#include "Lucy/Document/HitDoc.h"
@@ -269,11 +270,13 @@ typedef Obj* (*random_generator_t)();
static Obj*
S_random_string() {
size_t length = 1 + rand() % 10;
- String *string = Str_new(length);
+ CharBuf *buf = CB_new(length);
while (length--) {
uint32_t code_point = 'a' + rand() % ('z' - 'a' + 1);
- Str_Cat_Char(string, code_point);
+ CB_Cat_Char(buf, code_point);
}
+ String *string = CB_Yield_String(buf);
+ DECREF(buf);
return (Obj*)string;
}