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] Make some doublest.h parameters constant


FYI,

I've checked in the attached, it updates the read only parameters of 
functions like extract_floating() so that they are explicitly const.

	Andrew

PS: Yes I am aware of the line:
   unsigned char *ufrom = (unsigned char *) from;
found in floatformat_to_doublest, I'll get to that later :-)
2001-08-01  Andrew Cagney  <ac131313@redhat.com>

	* doublest.h (store_floating, floatformat_to_doublest): Make IN
	paramter a const void pointer.
	(floatformat_from_doublest): Make IN const, Make OUT a void
	pointer.
	* doublest.c (floatformat_to_doublest): Update.
	(floatformat_from_doublest): Update.
	(extract_floating): Update.

Index: doublest.c
===================================================================
RCS file: /cvs/src/src/gdb/doublest.c,v
retrieving revision 1.1
diff -p -r1.1 doublest.c
*** doublest.c	2001/08/01 18:39:23	1.1
--- doublest.c	2001/08/01 21:37:29
*************** get_field (unsigned char *data, enum flo
*** 105,111 ****
     Store the DOUBLEST in *TO.  */
  
  void
! floatformat_to_doublest (const struct floatformat *fmt, char *from,
  			 DOUBLEST *to)
  {
    unsigned char *ufrom = (unsigned char *) from;
--- 105,112 ----
     Store the DOUBLEST in *TO.  */
  
  void
! floatformat_to_doublest (const struct floatformat *fmt,
! 			 const void *from,
  			 DOUBLEST *to)
  {
    unsigned char *ufrom = (unsigned char *) from;
*************** ldfrexp (long double value, int *eptr)
*** 325,332 ****
     restrictions.  */
  
  void
! floatformat_from_doublest (CONST struct floatformat *fmt, DOUBLEST *from,
! 			   char *to)
  {
    DOUBLEST dfrom;
    int exponent;
--- 326,334 ----
     restrictions.  */
  
  void
! floatformat_from_doublest (CONST struct floatformat *fmt,
! 			   const DOUBLEST *from,
! 			   void *to)
  {
    DOUBLEST dfrom;
    int exponent;
*************** floatformat_mantissa (const struct float
*** 540,546 ****
     dirty work.  */
  
  DOUBLEST
! extract_floating (void *addr, int len)
  {
    DOUBLEST dretval;
  
--- 542,548 ----
     dirty work.  */
  
  DOUBLEST
! extract_floating (const void *addr, int len)
  {
    DOUBLEST dretval;
  
Index: doublest.h
===================================================================
RCS file: /cvs/src/src/gdb/doublest.h,v
retrieving revision 1.1
diff -p -r1.1 doublest.h
*** doublest.h	2001/08/01 18:39:23	1.1
--- doublest.h	2001/08/01 21:37:29
*************** typedef double DOUBLEST;
*** 73,87 ****
  #endif
  
  extern void floatformat_to_doublest (const struct floatformat *,
! 				     char *, DOUBLEST *);
  extern void floatformat_from_doublest (const struct floatformat *,
! 				       DOUBLEST *, char *);
  
  extern int floatformat_is_negative (const struct floatformat *, char *);
  extern int floatformat_is_nan (const struct floatformat *, char *);
  extern char *floatformat_mantissa (const struct floatformat *, char *);
  
! extern DOUBLEST extract_floating (void *, int);
  extern void store_floating (void *, int, DOUBLEST);
  
  #endif
--- 73,87 ----
  #endif
  
  extern void floatformat_to_doublest (const struct floatformat *,
! 				     const void *in, DOUBLEST *out);
  extern void floatformat_from_doublest (const struct floatformat *,
! 				       const DOUBLEST *in, void *out);
  
  extern int floatformat_is_negative (const struct floatformat *, char *);
  extern int floatformat_is_nan (const struct floatformat *, char *);
  extern char *floatformat_mantissa (const struct floatformat *, char *);
  
! extern DOUBLEST extract_floating (const void *in, int);
  extern void store_floating (void *, int, DOUBLEST);
  
  #endif

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