equal
deleted
inserted
replaced
72 { |
72 { |
73 int new_line_pos; |
73 int new_line_pos; |
74 int i,j; |
74 int i,j; |
75 for(i=0; i < len; ++i) |
75 for(i=0; i < len; ++i) |
76 { |
76 { |
|
77 /* prepare ltrimming when finding the first newline character */ |
77 if (def[i] == '\n') |
78 if (def[i] == '\n') |
78 { |
79 { |
|
80 /* Remove spaces after the first newline */ |
|
81 for(i+=1; def[i] == ' '; ++i); |
|
82 |
79 /* Break */ |
83 /* Break */ |
80 memmove(def, def + i + 1 /* \n */, |
84 memmove(def, def + i, |
81 len - i - 1); |
85 len - i - 1); |
82 def[len-i-1] = 0; |
86 def[len-i-1] = 0; |
83 return len-i-2/*\n*/+1/*\0*/; |
87 return len-i-1+1/*\0*/; |
84 } |
88 } |
85 } |
89 } |
86 return len; |
90 return len; |
87 } |
91 } |
88 |
92 |
167 } |
171 } |
168 |
172 |
169 static const char * search_next(struct Dict *d, const char *word, const char *from) |
173 static const char * search_next(struct Dict *d, const char *word, const char *from) |
170 { |
174 { |
171 const char *ret; |
175 const char *ret; |
172 ret = skip_until_newline(d, from); |
176 ret = skip_until_newline(d, from) + 1; |
173 if (compare(from, word) == 0) |
177 if (ret == (char *) 1) /* pointer at end */ |
|
178 return 0; |
|
179 if (compare(word, ret) == 0) |
174 return ret; |
180 return ret; |
175 return 0; |
181 return 0; |
176 } |
182 } |
177 |
183 |
178 static const char * bin_search(struct Dict *d, const char *word) |
184 static const char * bin_search(struct Dict *d, const char *word) |