diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-04-19 16:17:27 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-04-19 16:17:27 +0200 |
commit | 6116cb23cc2074f232397b406fabab1606b28fb6 (patch) | |
tree | 898b063730cc9f5bf2b0eff89c082015a03985f6 | |
parent | 5fd3ddfb243f8f3a8ef471ff8c323a76cf815574 (diff) | |
download | busybox-w32-6116cb23cc2074f232397b406fabab1606b28fb6.tar.gz busybox-w32-6116cb23cc2074f232397b406fabab1606b28fb6.tar.bz2 busybox-w32-6116cb23cc2074f232397b406fabab1606b28fb6.zip |
modprobe-small: remove redundant aliases from modules.dep.bb
function old new delta
parse_module 309 395 +86
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | modutils/modprobe-small.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 023755db3..223eba915 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
@@ -212,6 +212,7 @@ static void parse_module(module_info *info, const char *pathname) | |||
212 | reset_stringbuf(); | 212 | reset_stringbuf(); |
213 | pos = 0; | 213 | pos = 0; |
214 | while (1) { | 214 | while (1) { |
215 | unsigned start = stringbuf_idx; | ||
215 | ptr = find_keyword(module_image + pos, len - pos, "alias="); | 216 | ptr = find_keyword(module_image + pos, len - pos, "alias="); |
216 | if (!ptr) { | 217 | if (!ptr) { |
217 | ptr = find_keyword(module_image + pos, len - pos, "__ksymtab_"); | 218 | ptr = find_keyword(module_image + pos, len - pos, "__ksymtab_"); |
@@ -228,6 +229,31 @@ static void parse_module(module_info *info, const char *pathname) | |||
228 | } | 229 | } |
229 | append(ptr); | 230 | append(ptr); |
230 | appendc(' '); | 231 | appendc(' '); |
232 | /* | ||
233 | * Don't add redundant aliases, such as: | ||
234 | * libcrc32c.ko symbol:crc32c symbol:crc32c | ||
235 | */ | ||
236 | if (start) { /* "if we aren't the first alias" */ | ||
237 | char *found, *last; | ||
238 | stringbuf[stringbuf_idx] = '\0'; | ||
239 | last = stringbuf + start; | ||
240 | /* | ||
241 | * String at last-1 is " symbol:crc32c " | ||
242 | * (with both leading and trailing spaces). | ||
243 | */ | ||
244 | if (strncmp(stringbuf, last, stringbuf_idx - start) == 0) | ||
245 | /* First alias matches us */ | ||
246 | found = stringbuf; | ||
247 | else | ||
248 | /* Does any other alias match? */ | ||
249 | found = strstr(stringbuf, last-1); | ||
250 | if (found < last-1) { | ||
251 | /* There is absolutely the same string before us */ | ||
252 | dbg2_error_msg("redundant:'%s'", last); | ||
253 | stringbuf_idx = start; | ||
254 | goto skip; | ||
255 | } | ||
256 | } | ||
231 | skip: | 257 | skip: |
232 | pos = (ptr - module_image); | 258 | pos = (ptr - module_image); |
233 | } | 259 | } |