All pastes #1503114 Raw Edit

Anonymous

public c v1 · immutable
#1503114 ·published 2009-07-22 12:12 UTC
rendered paste body
void tokenize_text(WORD **wp, char cp[1024], size_t *sp, size_t *up){  WORD *word_list = *wp;  int i;  char *word;  char *temp;  i = *up / sizeof(WORD) - 1;  word = strtok(cp, ".,? \n");  while (word != NULL) {    i++;    word_list = (WORD *)alloc_array(word_list, sp, *up, sizeof(WORD));    word_list[i].word = (char *)malloc(sizeof(char) * WORD_SIZE);    word_list[i].text = (char *)malloc(sizeof(char) * TEXT_SIZE);    temp = word_list[i].word;    strncpy(temp, word, WORD_SIZE);    trim_symbol(temp, WORD_SIZE);    word = strtok(NULL, ".,? \n");    *up += sizeof(WORD);  }  *wp = word_list;}