This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
[RFC] Notes on QUIT and STREQ et.al.
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [RFC] Notes on QUIT and STREQ et.al.
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 13 Mar 2000 21:51:05 +1100
- Organization: Cygnus Solutions
The attatched spells out the long term prospects of both STREQ et.al.
and QUIT.
Look OK to everyone?
Andrew
Mon Mar 13 21:21:41 2000 Andrew Cagney <cagney@b1.cygnus.com>
* defs.h (STREQ): Note that the STR* macros do not need to be
used.
(QUIT): Note that this can probably be replaced by a function.
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.11
diff -p -r1.11 defs.h
*** defs.h 2000/03/13 07:30:00 1.11
--- defs.h 2000/03/13 10:24:00
*************** extern int core_addr_greaterthan (CORE_A
*** 120,125 ****
--- 120,130 ----
/* Gdb does *lots* of string compares. Use macros to speed them up by
avoiding function calls if the first characters are not the same. */
+ /* NOTE: cagney/2000-03-13: There is no reason for using these macros
+ in new code (which is just short of marking them as deprecated).
+ While old code can continue to refer to them, new code is better
+ off using the more familar strcmp(). */
+
#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b))
#define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0)
#define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0)
*************** extern int immediate_quit;
*** 152,157 ****
--- 157,167 ----
extern int sevenbit_strings;
extern void quit (void);
+
+ /* FIXME: cagney/2000-03-13: It has been suggested that the peformance
+ benefits of having a ``QUIT'' macro rather than a function are
+ marginal. Before QUIT can be replaced by a function, a profile
+ confirming this, would be needed. */
#ifdef QUIT
/* do twice to force compiler warning */