introduce and use bb_basename()
function old new delta bb_basename - 26 +26 sv_main 1226 1225 -1 passwd_main 1985 1983 -2 showdirs 482 478 -4 sendCgi 1811 1807 -4 make_device 1354 1350 -4 handleIncoming 2443 2439 -4 func_name 82 78 -4 service_name 2292 2285 -7 main 909 901 -8 cmp_main 555 547 -8 test_main 434 422 -12 act 228 216 -12 find_pair 180 164 -16 rmmod_main 298 280 -18 find_pid_by_name 156 134 -22 modprobe_main 1606 1576 -30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/16 up/down: 26/-156) Total: -130 bytes text data bss dec hex filename 734933 3028 14400 752361 b7ae9 busybox_old 734801 3028 14400 752229 b7a65 busybox_unstripped
This commit is contained in:
@ -376,18 +376,13 @@ static struct dep_t *build_dep(void)
|
||||
|
||||
if (col) {
|
||||
/* This line is a dep description */
|
||||
char *mods;
|
||||
const char *mods;
|
||||
char *modpath;
|
||||
char *mod;
|
||||
|
||||
/* Find the beginning of the module file name */
|
||||
*col = 0;
|
||||
mods = strrchr(buffer, '/');
|
||||
|
||||
if (!mods)
|
||||
mods = buffer; /* no path for this module */
|
||||
else
|
||||
mods++; /* there was a path for this module... */
|
||||
mods = bb_basename(buffer);
|
||||
|
||||
/* find the path of the module */
|
||||
modpath = strchr(buffer, '/'); /* ... and this is the path */
|
||||
@ -433,7 +428,7 @@ static struct dep_t *build_dep(void)
|
||||
/* p points to the first dependable module; if NULL, no dependable module */
|
||||
if (p && *p) {
|
||||
char *end = &buffer[l-1];
|
||||
char *deps;
|
||||
const char *deps;
|
||||
char *dep;
|
||||
char *next;
|
||||
int ext = 0;
|
||||
@ -451,15 +446,11 @@ static struct dep_t *build_dep(void)
|
||||
next = end;
|
||||
|
||||
/* find the beginning of the module file name */
|
||||
deps = strrchr(p, '/');
|
||||
|
||||
if (!deps || (deps < p)) {
|
||||
deps = p;
|
||||
|
||||
deps = bb_basename(p);
|
||||
if (deps == p) {
|
||||
while (isblank(*deps))
|
||||
deps++;
|
||||
} else
|
||||
deps++;
|
||||
}
|
||||
|
||||
/* find the end of the module name in the file name */
|
||||
if (ENABLE_FEATURE_2_6_MODULES
|
||||
|
@ -81,12 +81,7 @@ int rmmod_main(int argc, char **argv)
|
||||
|
||||
for (n = optind; n < argc; n++) {
|
||||
if (ENABLE_FEATURE_2_6_MODULES) {
|
||||
const char *afterslash;
|
||||
|
||||
afterslash = strrchr(argv[n], '/');
|
||||
if (!afterslash) afterslash = argv[n];
|
||||
else afterslash++;
|
||||
filename2modname(misc_buf, afterslash);
|
||||
filename2modname(misc_buf, bb_basename(argv[n]));
|
||||
}
|
||||
|
||||
if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) {
|
||||
|
Reference in New Issue
Block a user