*: 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
This commit is contained in:
@ -485,23 +485,19 @@ static module_info* find_alias(const char *alias)
|
||||
}
|
||||
|
||||
#if ENABLE_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED
|
||||
// TODO: open only once, invent config_rewind()
|
||||
static int already_loaded(const char *name)
|
||||
{
|
||||
int ret = 0;
|
||||
int len = strlen(name);
|
||||
char *line;
|
||||
FILE* modules;
|
||||
|
||||
modules = xfopen_for_read("/proc/modules");
|
||||
while ((line = xmalloc_fgets(modules)) != NULL) {
|
||||
if (strncmp(line, name, len) == 0 && line[len] == ' ') {
|
||||
free(line);
|
||||
char *s;
|
||||
parser_t *parser = config_open2("/proc/modules", xfopen_for_read);
|
||||
while (config_read(parser, &s, 1, 1, "# \t", 0)) {
|
||||
if (strcmp(s, name) == 0) {
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
free(line);
|
||||
}
|
||||
fclose(modules);
|
||||
config_close(parser);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
|
Reference in New Issue
Block a user