Permalink
Browse files

change unused char * to void, we just need the start and end

  • Loading branch information...
1 parent 965b167 commit 4922bc5e9c7b0a12153fc9a5b7679bfecba4a863 @sweemeng committed May 3, 2011
Showing with 3 additions and 15 deletions.
  1. +2 −14 libraries/storyboard/WordGenerator.cpp
  2. +1 −1 libraries/storyboard/WordGenerator.h
@@ -61,7 +61,7 @@ int WordGenerator::get_delimiter(int pos){
return p;
}
-char *WordGenerator::word_select(){
+void WordGenerator::word_select(){
int word_start = TrueRandom.random(this->segment_begin,this->segment_end);
word_start = this->get_delimiter(word_start);
if(word_start == this->segment_end){
@@ -72,19 +72,7 @@ char *WordGenerator::word_select(){
word_start = word_start + 1;
word_end = word_end;
this->end = word_end;
- int word_size = word_end - word_start;
- char *s_word;
- s_word = (char *)malloc(word_size * sizeof(char));
- int count = 0;
-
- for(int i = word_start;i < word_end;i++){
- s_word[count] = storage.read(i);
- count++;
- if(count == word_size){
- break;
- }
- }
- return s_word;
+
}
int WordGenerator::get_segment_begin(){
@@ -12,7 +12,7 @@ class WordGenerator{
int byte_to_int(byte *);
void get_segment(int);
int get_delimiter(int);
- char *word_select();
+ void word_select();
int get_segment_begin();
int get_segment_end();
void put_storage(int,int);

0 comments on commit 4922bc5

Please sign in to comment.