aboutsummaryrefslogtreecommitdiff
path: root/sim/sh
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-01-03 01:40:46 -0500
committerMike Frysinger <vapier@gentoo.org>2016-01-03 04:08:56 -0500
commit34fed69938f1296b62354b2a825b49602fe7af50 (patch)
treeaeece93f7f3f39429d4b92cb7e4e16a6217d8f64 /sim/sh
parentaba6f46b235a3a139c04d5ed6a3310125aa9c982 (diff)
downloadgdb-34fed69938f1296b62354b2a825b49602fe7af50.zip
gdb-34fed69938f1296b62354b2a825b49602fe7af50.tar.gz
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')
-rw-r--r--sim/sh/ChangeLog5
-rw-r--r--sim/sh/interp.c20
2 files changed, 8 insertions, 17 deletions
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 7fd3492..b3f8854 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,5 +1,10 @@
2016-01-03 Mike Frysinger <vapier@gentoo.org>
+ * interp.c (count_argc): Delete.
+ (trap): Change count_argc to countargv.
+
+2016-01-03 Mike Frysinger <vapier@gentoo.org>
+
* configure.ac (SIM_AC_OPTION_HOSTENDIAN): Delete.
* configure: Regenerate.
* interp.c (host_little_endian): Change CURRENT_HOST_BYTE_ORDER
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;