This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] s/struct _serial_t/struct serial/


Hello,

The attached cleans up (a tiny bit) of the serial.h code.  I don't think 
there are any existing systems that define ``struct serial'' in their 
header files.

The operation s/serial_t/struct serial */ should be a fairly obvious 
corollary.  I'll commit that shortly.

	Andrew
2001-07-09  Andrew Cagney  <ac131313@redhat.com>

	* serial.h (struct serial): Rename `struct _serial_t'.
	* serial.c (XMALLOC): Define.
	(serial_open): Update. Use XMALLOC.
	(serial_fdopen): Ditto.

Index: serial.c
===================================================================
RCS file: /cvs/src/src/gdb/serial.c,v
retrieving revision 1.9
diff -p -r1.9 serial.c
*** serial.c	2001/03/06 08:21:16	1.9
--- serial.c	2001/07/09 14:36:31
*************** static const char logbase_ascii[] = "asc
*** 58,63 ****
--- 58,66 ----
  static const char *logbase_enums[] =
  {logbase_hex, logbase_octal, logbase_ascii, NULL};
  static const char *serial_logbase = logbase_ascii;
+ 
+ #undef XMALLOC
+ #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
  
  
  
*************** serial_open (const char *name)
*** 202,208 ****
    if (!ops)
      return NULL;
  
!   scb = (serial_t) xmalloc (sizeof (struct _serial_t));
  
    scb->ops = ops;
  
--- 205,211 ----
    if (!ops)
      return NULL;
  
!   scb = XMALLOC (struct serial);
  
    scb->ops = ops;
  
*************** serial_fdopen (const int fd)
*** 254,260 ****
    if (!ops)
      return NULL;
  
!   scb = (serial_t) xmalloc (sizeof (struct _serial_t));
  
    scb->ops = ops;
  
--- 257,263 ----
    if (!ops)
      return NULL;
  
!   scb = XMALLOC (struct serial);
  
    scb->ops = ops;
  
Index: serial.h
===================================================================
RCS file: /cvs/src/src/gdb/serial.h,v
retrieving revision 1.3
diff -p -r1.3 serial.h
*** serial.h	2001/03/06 08:21:16	1.3
--- serial.h	2001/07/09 14:36:32
***************
*** 29,36 ****
     interface. */
  
  typedef void *serial_ttystate;
! struct _serial_t;
! typedef struct _serial_t *serial_t;
  
  /* Try to open NAME.  Returns a new serial_t on success, NULL on
     failure. */
--- 29,36 ----
     interface. */
  
  typedef void *serial_ttystate;
! struct serial;
! typedef struct serial *serial_t;
  
  /* Try to open NAME.  Returns a new serial_t on success, NULL on
     failure. */
*************** extern int serial_debug_p (serial_t scb)
*** 199,205 ****
  
  /* Details of an instance of a serial object */
  
! struct _serial_t
    {
      int fd;			/* File descriptor */
      struct serial_ops *ops;	/* Function vector */
--- 199,205 ----
  
  /* Details of an instance of a serial object */
  
! struct serial
    {
      int fd;			/* File descriptor */
      struct serial_ops *ops;	/* Function vector */
*************** struct _serial_t
*** 215,221 ****
  				   still need to wait for this many
  				   more seconds.  */
      char *name;			/* The name of the device or host */
!     struct _serial_t *next;	/* Pointer to the next serial_t */
      int refcnt;			/* Number of pointers to this block */
      int debug_p;		/* Trace this serial devices operation. */
      int async_state;		/* Async internal state. */
--- 215,221 ----
  				   still need to wait for this many
  				   more seconds.  */
      char *name;			/* The name of the device or host */
!     struct serial *next;	/* Pointer to the next serial_t */
      int refcnt;			/* Number of pointers to this block */
      int debug_p;		/* Trace this serial devices operation. */
      int async_state;		/* Async internal state. */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]