/* Read a word from the file in as a tree item. */TreeItem *readTreeItem(FILE * infile) { char *word; TreeItem *item; /* we scan one word at a time */ if(!feof(infile) && fscanf(infile, "%s", word) != EOF) { /* allocate the tree item */ if((item = XMALLOC(TreeItem *, sizeof(TreeItem))) == NULL) { ERROR_XMALLOC("Could not allocate enough memory for 'item'."); } /* dynamically allocate the word in the tree item */ if((item->word = XMALLOC(char *, sizeof(char) * (strlen(word)+1))) == NULL) { ERROR_XMALLOC("Could not allocate enough memory for 'item->word'."); } *item->word = *word; return item; } return NULL;}