Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fred Fish <fnf@specifix.com>
To: gdb-patches@sources.redhat.com
Cc: fnf@specifix.com
Subject: RFA: Make parse_frame_specification static, remove code duplication
Date: Fri, 05 Aug 2005 15:56:00 -0000	[thread overview]
Message-ID: <200508051156.48102.fnf@specifix.com> (raw)

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);
  


             reply	other threads:[~2005-08-05 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-05 15:56 Fred Fish [this message]
2005-08-05 17:39 ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200508051156.48102.fnf@specifix.com \
    --to=fnf@specifix.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox