|
From: <sv...@va...> - 2012-09-13 20:21:51
|
florian 2012-09-13 21:21:42 +0100 (Thu, 13 Sep 2012)
New Revision: 2530
Log:
Constify the format string in a few printf-like functions.
Modified files:
trunk/priv/host_s390_disasm.c
trunk/priv/main_util.c
trunk/priv/main_util.h
Modified: trunk/priv/main_util.h (+3 -3)
===================================================================
--- trunk/priv/main_util.h 2012-09-13 20:33:24 +01:00 (rev 2529)
+++ trunk/priv/main_util.h 2012-09-13 21:21:42 +01:00 (rev 2530)
@@ -60,16 +60,16 @@
extern void vex_assert_fail ( const HChar* expr, const HChar* file,
Int line, const HChar* fn );
__attribute__ ((__noreturn__))
-extern void vpanic ( HChar* str );
+extern void vpanic ( const HChar* str );
/* Printing */
__attribute__ ((format (printf, 1, 2)))
-extern UInt vex_printf ( HChar *format, ... );
+extern UInt vex_printf ( const HChar *format, ... );
__attribute__ ((format (printf, 2, 3)))
-extern UInt vex_sprintf ( HChar* buf, HChar *format, ... );
+extern UInt vex_sprintf ( HChar* buf, const HChar *format, ... );
/* String ops */
Modified: trunk/priv/main_util.c (+5 -5)
===================================================================
--- trunk/priv/main_util.c 2012-09-13 20:33:24 +01:00 (rev 2529)
+++ trunk/priv/main_util.c 2012-09-13 21:21:42 +01:00 (rev 2530)
@@ -220,7 +220,7 @@
}
__attribute__ ((noreturn))
-void vpanic ( HChar* str )
+void vpanic ( const HChar* str )
{
vex_printf("\nvex: the `impossible' happened:\n %s\n", str);
(*vex_failure_exit)();
@@ -316,7 +316,7 @@
printf. */
static
UInt vprintf_wrk ( void(*sink)(HChar),
- HChar* format,
+ const HChar* format,
va_list ap )
{
# define PUT(_ch) \
@@ -331,7 +331,7 @@
do { HChar* _qq = _str; for (; *_qq; _qq++) PUT(*_qq); } \
while (0)
- HChar* saved_format;
+ const HChar* saved_format;
Bool longlong, ljustify;
HChar padchar;
Int fwidth, nout, len1, len2, len3;
@@ -494,7 +494,7 @@
}
}
-UInt vex_printf ( HChar* format, ... )
+UInt vex_printf ( const HChar* format, ... )
{
UInt ret;
va_list vargs;
@@ -523,7 +523,7 @@
*vg_sprintf_ptr++ = c;
}
-UInt vex_sprintf ( HChar* buf, HChar *format, ... )
+UInt vex_sprintf ( HChar* buf, const HChar *format, ... )
{
Int ret;
va_list vargs;
Modified: trunk/priv/host_s390_disasm.c (+2 -4)
===================================================================
--- trunk/priv/host_s390_disasm.c 2012-09-13 20:33:24 +01:00 (rev 2529)
+++ trunk/priv/host_s390_disasm.c 2012-09-13 21:21:42 +01:00 (rev 2530)
@@ -36,10 +36,8 @@
#include "main_globals.h" // vex_traceflags
#include "host_s390_disasm.h"
-/* The format that is used to write out a mnemonic.
- These should be declared as 'const HChar' but vex_printf needs
- to be changed for that first */
-static HChar s390_mnm_fmt[] = "%-8s";
+/* The format that is used to write out a mnemonic. */
+static const HChar s390_mnm_fmt[] = "%-8s";
/* Return the name of a general purpose register for dis-assembly purposes. */
|