This file is part of Valgrind, a dynamic binary instrumentation
framework.
- Copyright (C) 2004-2011 OpenWorks LLP
+ Copyright (C) 2004-2013 OpenWorks LLP
info@open-works.net
This program is free software; you can redistribute it and/or
__attribute__((noreturn))
void private_LibVEX_alloc_OOM(void)
{
- HChar* pool = "???";
+ const HChar* pool = "???";
if (private_LibVEX_alloc_first == &temporary[0]) pool = "TEMP";
if (private_LibVEX_alloc_first == &permanent[0]) pool = "PERM";
vex_printf("VEX temporary storage exhausted.\n");
}
__attribute__ ((noreturn))
-void vpanic ( HChar* str )
+void vpanic ( const HChar* str )
{
vex_printf("\nvex: the `impossible' happened:\n %s\n", str);
(*vex_failure_exit)();
}
}
+void vex_bzero ( void* sV, UInt n )
+{
+ UInt i;
+ UChar* s = (UChar*)sV;
+ /* No laughing, please. Just don't call this too often. Thank you
+ for your attention. */
+ for (i = 0; i < n; i++) s[i] = 0;
+}
+
/* Convert N0 into ascii in BUF, which is assumed to be big enough (at
least 67 bytes long). Observe BASE, SYNED and HEXCAPS. */
printf. */
static
UInt vprintf_wrk ( void(*sink)(HChar),
- HChar* format,
+ const HChar* format,
va_list ap )
{
# define PUT(_ch) \
while (0)
# define PUTSTR(_str) \
- do { HChar* _qq = _str; for (; *_qq; _qq++) PUT(*_qq); } \
+ do { const 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;
format++;
padchar = '0';
}
- while (*format >= '0' && *format <= '9') {
- fwidth = fwidth * 10 + (*format - '0');
+ if (*format == '*') {
+ fwidth = va_arg(ap, Int);
format++;
+ } else {
+ while (*format >= '0' && *format <= '9') {
+ fwidth = fwidth * 10 + (*format - '0');
+ format++;
+ }
}
if (*format == 'l') {
format++;
switch (*format) {
case 's': {
- HChar* str = va_arg(ap, HChar*);
+ const HChar* str = va_arg(ap, HChar*);
if (str == NULL)
str = "(null)";
len1 = len3 = 0;
}
}
-UInt vex_printf ( HChar* format, ... )
+UInt vex_printf ( const HChar* format, ... )
{
UInt ret;
va_list vargs;
*vg_sprintf_ptr++ = c;
}
-UInt vex_sprintf ( HChar* buf, HChar *format, ... )
+UInt vex_sprintf ( HChar* buf, const HChar *format, ... )
{
Int ret;
va_list vargs;