public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: use cli-utils whitespace functions
@ 2011-03-16 18:24 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-03-16 18:24 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  c8a73f06993b81d44060ac96399908dd66a55ae9 (commit)
      from  17b2aad99cd17977c3ba93fa870f499608e13bd8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit c8a73f06993b81d44060ac96399908dd66a55ae9
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Mar 16 12:19:29 2011 -0600

    use cli-utils whitespace functions

-----------------------------------------------------------------------

Summary of changes:
 gdb/stap-probe.c |   39 +++++++++++++++------------------------
 1 files changed, 15 insertions(+), 24 deletions(-)

First 500 lines of diff:
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index c8c61bc..6d76c26 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -32,6 +32,7 @@
 #include "ax-gdb.h"
 #include "user-regs.h"
 #include "complaints.h"
+#include "cli/cli-utils.h"
 
 #include <ctype.h>
 
@@ -98,19 +99,10 @@ static struct stap_args_info dummy_stap_args_info =
   { 0, NULL, NULL };
 
 static void
-ep_skip_leading_whitespace (char **s)
-{
-  if ((s == NULL) || (*s == NULL))
-    return;
-  while (isspace (**s))
-    *s += 1;
-}
-
-static void
 stap_skip_whitespace_cond (char **s, int inside_paren)
 {
   if (inside_paren)
-    ep_skip_leading_whitespace (s);
+    *s = skip_spaces (*s);
 }
 
 static int
@@ -145,7 +137,7 @@ stap_parse_arg (const char **p)
 	  --paren_open;
 	  ++cur;
 	  if (paren_open)
-	    ep_skip_leading_whitespace (&cur);
+	    cur = skip_spaces (cur);
 	  break;
 
 	case '+': case '-':
@@ -265,7 +257,7 @@ stap_parse_arg (const char **p)
 
 	      /* We have to do a lookahead here, because the user may
 		 input `2 + 2' (with spaces), and this is not an error.  */
-	      ep_skip_leading_whitespace (&cur);
+	      cur = skip_spaces (cur);
 
 	      switch (*cur)
 		{
@@ -434,7 +426,7 @@ allowed"),
 	      args_info->arg[current_arg].arg_str
 		= savestring (start, cur - start);
 	      /* Start it over again.  */
-	      ep_skip_leading_whitespace ((char **) &cur);
+	      cur = skip_spaces ((char *) cur);
 	      current_state = NEW_ARG;
 	    }
 	  break;
@@ -780,7 +772,7 @@ stap_parse_single_operand (struct stap_evaluation_info *eval_info)
 	  char c = *eval_info->exp_buf;
 
 	  ++eval_info->exp_buf;
-	  ep_skip_leading_whitespace (&eval_info->exp_buf);
+	  eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
 	  if (*eval_info->exp_buf
 	      && *eval_info->exp_buf == '('
 	      && eval_info->exp_buf[1] != '%')
@@ -806,7 +798,7 @@ stap_parse_single_operand (struct stap_evaluation_info *eval_info)
 		  int number = strtol (eval_info->exp_buf,
 				       &eval_info->exp_buf, 0);
 
-		  ep_skip_leading_whitespace (&eval_info->exp_buf);
+		  eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
 
 		  res
 		    = value_from_longest (builtin_type (gdbarch)->builtin_int,
@@ -857,14 +849,14 @@ stap_parse_single_operand (struct stap_evaluation_info *eval_info)
 	int number;
 
 	++eval_info->exp_buf;
-	ep_skip_leading_whitespace (&eval_info->exp_buf);
+	eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
 
 	number = strtol (eval_info->exp_buf, &eval_info->exp_buf, 0);
 
 	res = value_from_longest (builtin_type (gdbarch)->builtin_int,
 				  number);
 
-	ep_skip_leading_whitespace (&eval_info->exp_buf);
+	eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
       }
     break;
 
@@ -899,7 +891,7 @@ stap_evaluate_conditionally (struct stap_evaluation_info *eval_info)
   else if (*s == '(')
     {
       ++eval_info->exp_buf;
-      ep_skip_leading_whitespace (&eval_info->exp_buf);
+      eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
 
       ret = stap_evaluate_probe_argument_2 (eval_info,
 					    /*lhs=*/NULL, /*prec=*/0);
@@ -908,7 +900,7 @@ stap_evaluate_conditionally (struct stap_evaluation_info *eval_info)
 	error (_("Missign close-paren on expression `%s'."),
 	       eval_info->saved_expr);
       ++eval_info->exp_buf;
-      ep_skip_leading_whitespace (&eval_info->exp_buf);
+      eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
     }
 
   return ret;
@@ -920,7 +912,7 @@ stap_evaluate_probe_argument_2 (struct stap_evaluation_info *eval_info,
 {
   struct value *rhs = NULL;
 
-  ep_skip_leading_whitespace (&eval_info->exp_buf);
+  eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
 
   if (!lhs)
     /* We have to evaluate the left side of this expression.  */
@@ -943,7 +935,7 @@ stap_evaluate_probe_argument_2 (struct stap_evaluation_info *eval_info,
       if (cur_prec < prec)
 	break;
 
-      ep_skip_leading_whitespace (&eval_info->exp_buf);
+      eval_info->exp_buf = skip_spaces (eval_info->exp_buf);
 
       rhs = stap_evaluate_conditionally (eval_info);
 
@@ -1057,14 +1049,13 @@ extract_arg (char **arg)
     return NULL;
 
   /* Find the start of the argument.  */
-  ep_skip_leading_whitespace (arg);
+  *arg = skip_spaces (*arg);
   if (! **arg)
     return NULL;
   result = *arg;
 
   /* Find the end of the argument.  */
-  for (++*arg; **arg && ! isspace (**arg); ++*arg)
-    ;
+  *arg = skip_to_space (*arg + 1);
 
   if (result == *arg)
     return NULL;


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-16 18:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-16 18:24 [SCM] archer-sergiodj-stap: use cli-utils whitespace functions tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).