From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9731 invoked by alias); 1 Jan 2010 08:43:42 -0000 Received: (qmail 9716 invoked by uid 22791); 1 Jan 2010 08:43:40 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,FH_DATE_PAST_20XX,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jan 2010 08:43:36 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o018hZGX004093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 1 Jan 2010 03:43:35 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o018hWWo007919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 1 Jan 2010 03:43:34 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o018hWip030120 for ; Fri, 1 Jan 2010 09:43:32 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o018hWcl030116 for gdb-patches@sourceware.org; Fri, 1 Jan 2010 09:43:32 +0100 Date: Fri, 01 Jan 2010 08:43:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Rename process_next_line variables Message-ID: <20100101084332.GA30042@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-01/txt/msg00008.txt.bz2 Hi, just a simple %s, it is a patch on top of: [patch] Fix crash on CLI indented comments [Re: [Bug:cli] Loading user-defined function generates an internal error] http://sourceware.org/ml/gdb-patches/2010-01/msg00007.html Nothing important, np to drop it. Thanks, Jan 2010-01-01 Jan Kratochvil * cli/cli-script.c (process_next_line): Rename p1 as p_end and p2 as p_start. --- ./gdb/cli/cli-script.c-p0 2010-01-01 09:31:38.000000000 +0100 +++ ./gdb/cli/cli-script.c 2010-01-01 09:33:30.000000000 +0100 @@ -878,8 +878,8 @@ read_next_line () static enum misc_command_type process_next_line (char *p, struct command_line **command, int parse_commands) { - char *p1; - char *p2; + char *p_end; + char *p_start; int not_handled = 0; /* Not sure what to do here. */ @@ -887,18 +887,18 @@ process_next_line (char *p, struct comma return end_command; /* Strip trailing whitespace. */ - p1 = p + strlen (p); - while (p1 != p && (p1[-1] == ' ' || p1[-1] == '\t')) - p1--; + p_end = p + strlen (p); + while (p_end > p && (p_end[-1] == ' ' || p_end[-1] == '\t')) + p_end--; - p2 = p; + p_start = p; /* Strip leading whitespace. */ - while (p2 != p1 && (*p2 == ' ' || *p2 == '\t')) - p2++; + while (p_start < p_end && (*p_start == ' ' || *p_start == '\t')) + p_start++; /* 'end' is always recognized, regardless of parse_commands value. We also permit whitespace before end and after. */ - if (p1 - p2 == 3 && !strncmp (p2, "end", 3)) + if (p_end - p_start == 3 && !strncmp (p_start, "end", 3)) return end_command; if (parse_commands) @@ -906,51 +906,51 @@ process_next_line (char *p, struct comma /* If commands are parsed, we skip initial spaces. Otherwise, which is the case for Python commands and documentation (see the 'document' command), spaces are preserved. */ - p = p2; + p = p_start; /* Blanks and comments don't really do anything, but we need to distinguish them from else, end and other commands which can be executed. */ - if (p1 == p || p[0] == '#') + if (p_end == p || p[0] == '#') return nop_command; /* Is the else clause of an if control structure? */ - if (p1 - p == 4 && !strncmp (p, "else", 4)) + if (p_end - p == 4 && !strncmp (p, "else", 4)) return else_command; /* Check for while, if, break, continue, etc and build a new command line structure for them. */ - if (p1 - p > 5 && !strncmp (p, "while", 5)) + if (p_end - p > 5 && !strncmp (p, "while", 5)) { char *first_arg; first_arg = p + 5; - while (first_arg < p1 && isspace (*first_arg)) + while (first_arg < p_end && isspace (*first_arg)) first_arg++; *command = build_command_line (while_control, first_arg); } - else if (p1 - p > 2 && !strncmp (p, "if", 2)) + else if (p_end - p > 2 && !strncmp (p, "if", 2)) { char *first_arg; first_arg = p + 2; - while (first_arg < p1 && isspace (*first_arg)) + while (first_arg < p_end && isspace (*first_arg)) first_arg++; *command = build_command_line (if_control, first_arg); } - else if (p1 - p >= 8 && !strncmp (p, "commands", 8)) + else if (p_end - p >= 8 && !strncmp (p, "commands", 8)) { char *first_arg; first_arg = p + 8; - while (first_arg < p1 && isspace (*first_arg)) + while (first_arg < p_end && isspace (*first_arg)) first_arg++; *command = build_command_line (commands_control, first_arg); } - else if (p1 - p == 6 && !strncmp (p, "python", 6)) + else if (p_end - p == 6 && !strncmp (p, "python", 6)) { /* Note that we ignore the inline "python command" form here. */ *command = build_command_line (python_control, ""); } - else if (p1 - p == 10 && !strncmp (p, "loop_break", 10)) + else if (p_end - p == 10 && !strncmp (p, "loop_break", 10)) { *command = (struct command_line *) xmalloc (sizeof (struct command_line)); @@ -960,7 +960,7 @@ process_next_line (char *p, struct comma (*command)->body_count = 0; (*command)->body_list = NULL; } - else if (p1 - p == 13 && !strncmp (p, "loop_continue", 13)) + else if (p_end - p == 13 && !strncmp (p, "loop_continue", 13)) { *command = (struct command_line *) xmalloc (sizeof (struct command_line)); @@ -980,7 +980,7 @@ process_next_line (char *p, struct comma *command = (struct command_line *) xmalloc (sizeof (struct command_line)); (*command)->next = NULL; - (*command)->line = savestring (p, p1 - p); + (*command)->line = savestring (p, p_end - p); (*command)->control_type = simple_control; (*command)->body_count = 0; (*command)->body_list = NULL;