From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19401 invoked by alias); 5 Aug 2005 15:56:58 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19388 invoked by uid 22791); 5 Aug 2005 15:56:54 -0000 Received: from w099.z064220152.sjc-ca.dsl.cnc.net (HELO duck.specifix.com) (64.220.152.99) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 05 Aug 2005 15:56:54 +0000 Received: from diveadx (duck.specifix.com [64.220.152.99]) by duck.specifix.com (Postfix) with ESMTP id 91FCE47CD; Fri, 5 Aug 2005 08:56:52 -0700 (PDT) From: Fred Fish Reply-To: fnf@specifix.com To: gdb-patches@sources.redhat.com Subject: RFA: Make parse_frame_specification static, remove code duplication Date: Fri, 05 Aug 2005 15:56:00 -0000 User-Agent: KMail/1.8.2 Cc: fnf@specifix.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508051156.48102.fnf@specifix.com> X-SW-Source: 2005-08/txt/msg00083.txt.bz2 This patch turns a global function, that doesn't need to be global, into a static function, and removes a couple of lines of code duplication in stack.c. -Fred ============================================================================ 2005-08-02 Fred Fish * defs.h (parse_frame_specification): Remove prototype. * stack.c (parse_frame_specification): Add prototype and make function static. (frame_info): Move common code outside if..then..else. Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.188 diff -c -p -r1.188 defs.h *** defs.h 2 Aug 2005 03:02:05 -0000 1.188 --- defs.h 5 Aug 2005 15:52:06 -0000 *************** extern void (*deprecated_show_load_progr *** 1099,1105 **** extern void (*deprecated_print_frame_info_listing_hook) (struct symtab * s, int line, int stopline, int noerror); - extern struct frame_info *parse_frame_specification (char *frame_exp); extern int (*deprecated_query_hook) (const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1,0); extern void (*deprecated_warning_hook) (const char *, va_list) --- 1099,1104 ---- Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.134 diff -c -p -r1.134 stack.c *** stack.c 1 Aug 2005 18:32:51 -0000 1.134 --- stack.c 5 Aug 2005 15:52:06 -0000 *************** void _initialize_stack (void); *** 60,65 **** --- 60,67 ---- /* Prototypes for local functions. */ + static struct frame_info *parse_frame_specification (char *frame_exp); + static void down_command (char *, int); static void down_silently_base (char *); *************** parse_frame_specification_1 (const char *** 844,850 **** error (_("Too many args in frame specification")); } ! struct frame_info * parse_frame_specification (char *frame_exp) { return parse_frame_specification_1 (frame_exp, NULL, NULL); --- 846,852 ---- error (_("Too many args in frame specification")); } ! static struct frame_info * parse_frame_specification (char *frame_exp) { return parse_frame_specification_1 (frame_exp, NULL, NULL); *************** frame_info (char *addr_exp, int from_tty *** 932,946 **** { printf_filtered (_("Stack level %d, frame at "), frame_relative_level (fi)); - deprecated_print_address_numeric (get_frame_base (fi), 1, gdb_stdout); - printf_filtered (":\n"); } else { printf_filtered (_("Stack frame at ")); - deprecated_print_address_numeric (get_frame_base (fi), 1, gdb_stdout); - printf_filtered (":\n"); } printf_filtered (" %s = ", pc_regname); deprecated_print_address_numeric (get_frame_pc (fi), 1, gdb_stdout); --- 934,946 ---- { printf_filtered (_("Stack level %d, frame at "), frame_relative_level (fi)); } else { printf_filtered (_("Stack frame at ")); } + deprecated_print_address_numeric (get_frame_base (fi), 1, gdb_stdout); + printf_filtered (":\n"); printf_filtered (" %s = ", pc_regname); deprecated_print_address_numeric (get_frame_pc (fi), 1, gdb_stdout);