diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-01-03 01:40:46 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-01-03 04:08:56 -0500 |
commit | 34fed69938f1296b62354b2a825b49602fe7af50 (patch) | |
tree | aeece93f7f3f39429d4b92cb7e4e16a6217d8f64 /sim/sh/interp.c | |
parent | aba6f46b235a3a139c04d5ed6a3310125aa9c982 (diff) | |
download | fsf-binutils-gdb-34fed69938f1296b62354b2a825b49602fe7af50.zip fsf-binutils-gdb-34fed69938f1296b62354b2a825b49602fe7af50.tar.gz fsf-binutils-gdb-34fed69938f1296b62354b2a825b49602fe7af50.tar.bz2 |
sim: use libiberty countargv in more places
A bunch of places open code the countargv implementation, or outright
duplicate it (as count_argc). Replace all of those w/countargv.
Diffstat (limited to 'sim/sh/interp.c')
-rw-r--r-- | sim/sh/interp.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c index ee34e0d..f59ad00 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -240,20 +240,6 @@ do { \ #define FPSCR_SZ ((GET_FPSCR () & FPSCR_MASK_SZ) != 0) #define FPSCR_PR ((GET_FPSCR () & FPSCR_MASK_PR) != 0) -/* Count the number of arguments in an argv. */ -static int -count_argc (char **argv) -{ - int i; - - if (! argv) - return -1; - - for (i = 0; argv[i] != NULL; ++i) - continue; - return i; -} - static void set_fpscr1 (int x) { @@ -1056,16 +1042,16 @@ trap (SIM_DESC sd, int i, int *regs, unsigned char *insn_ptr, break; } case SYS_argc: - regs[0] = count_argc (prog_argv); + regs[0] = countargv (prog_argv); break; case SYS_argnlen: - if (regs[5] < count_argc (prog_argv)) + if (regs[5] < countargv (prog_argv)) regs[0] = strlen (prog_argv[regs[5]]); else regs[0] = -1; break; case SYS_argn: - if (regs[5] < count_argc (prog_argv)) + if (regs[5] < countargv (prog_argv)) { /* Include the termination byte. */ int i = strlen (prog_argv[regs[5]]) + 1; |