1: #include <stdio.h> 2: #include "bm.h" 3: #include "Extern.h" 4: extern char * malloc(); 5: /* makes a pattern descriptor */ 6: struct PattDesc *MakeDesc(Pattern) 7: char *Pattern; 8: { 9: struct PattDesc *Desc; 10: Desc = (struct PattDesc *) malloc(sizeof(struct PattDesc)); 11: if (!(Desc->Skip1 = (int *) malloc( sizeof(int) * (MAXCHAR + 1)))){ 12: fprintf(stderr,"bm: can't allocate space\n"); 13: exit(2); 14: } /* if */ 15: if (!(Desc->Skip2 = (int *) malloc(sizeof(int) * strlen(Pattern)))){ 16: fprintf(stderr,"bm: can't allocate space\n"); 17: exit(2); 18: } /* if */ 19: Desc->Pattern=Pattern; 20: Desc->PatLen = strlen(Desc->Pattern); 21: MakeSkip(Desc->Pattern,Desc->Skip1, 22: Desc->Skip2,Desc->PatLen); 23: return(Desc); 24: } /* main */