comparison playtreeparser.c @ 8907:e82149e697a7

bunkus: Another nice off-by-one :)
author mosu
date Sun, 12 Jan 2003 11:45:49 +0000
parents ef01554542fb
children 5c15777f1c07
comparison
equal deleted inserted replaced
8906:50ef2de1d9c4 8907:e82149e697a7
33 33
34 static void 34 static void
35 strstrip(char* str) { 35 strstrip(char* str) {
36 char* i; 36 char* i;
37 37
38 if (str==NULL)
39 return;
38 for(i = str ; i[0] != '\0' && strchr(WHITES,i[0]) != NULL; i++) 40 for(i = str ; i[0] != '\0' && strchr(WHITES,i[0]) != NULL; i++)
39 /* NOTHING */; 41 /* NOTHING */;
40 if(i[0] != '\0') { 42 if(i[0] != '\0') {
41 memmove(str,i,strlen(i)); 43 memmove(str,i,strlen(i) + 1);
42 for(i = str + strlen(str) ; strchr(WHITES,i[0]) != NULL; i--) 44 for(i = str + strlen(str) - 1 ; strchr(WHITES,i[0]) != NULL; i--)
43 /* NOTHING */; 45 /* NOTHING */;
44 i[1] = '\0'; 46 i[1] = '\0';
45 } else 47 } else
46 str[0] = '\0'; 48 str[0] = '\0';
47 } 49 }