Change slightly the way integers are printed by printf() and friends.

Previously, %d printed a 32-bit int.  %ld and %lld printed 64-bit ints.
So if you wanted to print a word-sized int (eg. a SizeT variable), you
had to cast it to a Long and then print with %lld in order to work on
both 32-bit and 64-bit platforms.

I changed things so that %d prints a 32-bit int, %ld prints a word-sized
int, and %lld prints a 64-bit int.  There are two advantages to this:
- it now matches the way the normal glibc printf() works;
- you can print word-sized ints without casting.

I also made the corresponding change for %u/lu/llu and %x/lx/llx, and I
changed a couple of VG_(printf)() invocations accordingly.





git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4527 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index bdf2769..2cde3d9 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -384,6 +384,7 @@
    Int  i;
    Int  flags;
    Int  width;
+   Int  n_ls = 0;
    Bool is_long;
 
    /* We assume that vargs has already been initialised by the 
@@ -408,7 +409,7 @@
          continue;
       }
       flags = 0;
-      is_long = False;
+      n_ls  = 0;
       width = 0; /* length of the field. */
       if (format[i] == '(') {
          flags |= VG_MSG_PAREN;
@@ -436,9 +437,16 @@
       }
       while (format[i] == 'l') {
          i++;
-         is_long = True;
+         n_ls++;
       }
 
+      //   %d means print a 32-bit integer.
+      //  %ld means print a word-size integer.
+      // %lld means print a 64-bit integer.
+      if      (0 == n_ls) { is_long = False; }
+      else if (1 == n_ls) { is_long = ( sizeof(void*) == sizeof(Long) ); }
+      else                { is_long = True; }
+
       switch (format[i]) {
          case 'd': /* %d */
             flags |= VG_MSG_SIGNED;