diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-24 23:38:04 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-24 23:38:04 +0000 |
commit | 0f99d49ae680e675809428deace3c4fe839d323c (patch) | |
tree | 712afab828ee4fb02493bc60e1a37f1142231263 /modutils | |
parent | 22f741484391c3b2fd94881fd41c8c0df9749e95 (diff) | |
download | busybox-w32-0f99d49ae680e675809428deace3c4fe839d323c.tar.gz busybox-w32-0f99d49ae680e675809428deace3c4fe839d323c.tar.bz2 busybox-w32-0f99d49ae680e675809428deace3c4fe839d323c.zip |
*: conversion to config parser
function old new delta
config_read 540 597 +57
config_open2 41 44 +3
rtnl_rtprot_initialize 70 66 -4
rtnl_rttable_initialize 78 73 -5
rtnl_rtscope_initialize 88 83 -5
rtnl_rtrealm_initialize 48 43 -5
rtnl_rtdsfield_initialize 48 43 -5
process_module 566 560 -6
bbunpack 391 383 -8
rtnl_tab_initialize 279 121 -158
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/8 up/down: 60/-196) Total: -136 bytes
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/modprobe-small.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index f75dae8a3..1654cc52d 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c | |||
@@ -485,23 +485,19 @@ static module_info* find_alias(const char *alias) | |||
485 | } | 485 | } |
486 | 486 | ||
487 | #if ENABLE_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED | 487 | #if ENABLE_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED |
488 | // TODO: open only once, invent config_rewind() | ||
488 | static int already_loaded(const char *name) | 489 | static int already_loaded(const char *name) |
489 | { | 490 | { |
490 | int ret = 0; | 491 | int ret = 0; |
491 | int len = strlen(name); | 492 | char *s; |
492 | char *line; | 493 | parser_t *parser = config_open2("/proc/modules", xfopen_for_read); |
493 | FILE* modules; | 494 | while (config_read(parser, &s, 1, 1, "# \t", 0)) { |
494 | 495 | if (strcmp(s, name) == 0) { | |
495 | modules = xfopen_for_read("/proc/modules"); | ||
496 | while ((line = xmalloc_fgets(modules)) != NULL) { | ||
497 | if (strncmp(line, name, len) == 0 && line[len] == ' ') { | ||
498 | free(line); | ||
499 | ret = 1; | 496 | ret = 1; |
500 | break; | 497 | break; |
501 | } | 498 | } |
502 | free(line); | ||
503 | } | 499 | } |
504 | fclose(modules); | 500 | config_close(parser); |
505 | return ret; | 501 | return ret; |
506 | } | 502 | } |
507 | #else | 503 | #else |