Constify the format string in a few printf-like functions.
git-svn-id: svn://svn.valgrind.org/vex/trunk@2530 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/host_s390_disasm.c b/priv/host_s390_disasm.c
index a23009e..ccccdde 100644
--- a/priv/host_s390_disasm.c
+++ b/priv/host_s390_disasm.c
@@ -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. */
diff --git a/priv/main_util.c b/priv/main_util.c
index b4ca7be..6f5fc1c 100644
--- a/priv/main_util.c
+++ b/priv/main_util.c
@@ -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;
diff --git a/priv/main_util.h b/priv/main_util.h
index bee6649..ce5aa00 100644
--- a/priv/main_util.h
+++ b/priv/main_util.h
@@ -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 */