This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFA: Make parse_frame_specification static, remove code duplication
- From: Fred Fish <fnf at specifix dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: fnf at specifix dot com
- Date: Fri, 5 Aug 2005 11:56:47 -0400
- Subject: RFA: Make parse_frame_specification static, remove code duplication
- Reply-to: fnf at specifix dot com
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 <fnf@specifix.com>
* 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);