]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Use longs to get the error counts as valgrind will expect to return a
authorTom Hughes <tom@compton.nu>
Tue, 24 May 2005 07:22:13 +0000 (07:22 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 24 May 2005 07:22:13 +0000 (07:22 +0000)
machine word. Based on diagnosis by Robert Walsh <rjwalsh@durables.org>.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3792

memcheck/tests/error_counts.c

index 7ec6dbfff9c079106c3484ebf778cddc74ed498e..89c0c23b0b94a85c2226d38dc020eb3e2091e9ae 100644 (file)
@@ -10,10 +10,10 @@ int main(void)
    int* reachable;
    int* dubious;
    int* leaked;
-   int  n_reachable  = 0;
-   int  n_dubious    = 0;
-   int  n_leaked     = 0;
-   int  n_suppressed = 0;
+   long n_reachable  = 0;
+   long n_dubious    = 0;
+   long n_leaked     = 0;
+   long n_suppressed = 0;
 
    /* we require these longs to have same size as a machine word */
    assert(sizeof(long) == sizeof(void*));
@@ -33,7 +33,7 @@ int main(void)
    VALGRIND_DO_LEAK_CHECK;
    VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed);
    if (n_reachable == 24) n_reachable = 0; /* handle glibc differences */
-   printf("leaks: %dB, %dB, %dB, %dB\n",
+   printf("leaks: %ldB, %ldB, %ldB, %ldB\n",
           n_leaked, n_dubious, n_reachable, n_suppressed);
 
    leaked = malloc(77);
@@ -48,7 +48,7 @@ int main(void)
    VALGRIND_DO_LEAK_CHECK;
    VALGRIND_COUNT_LEAKS(n_leaked, n_dubious, n_reachable, n_suppressed);
    if (n_reachable == 123) n_reachable = 99; /* handle glibc differences */
-   printf("leaks: %dB, %dB, %dB, %dB\n",
+   printf("leaks: %ldB, %ldB, %ldB, %ldB\n",
           n_leaked, n_dubious, n_reachable, n_suppressed);
 
    printf("errors: %d\n", VALGRIND_COUNT_ERRORS);