Cast int64 to ease the printf
authorCΓ©dric Villemain <cedric@2ndquadrant.fr>
Fri, 29 Jul 2011 09:50:12 +0000 (11:50 +0200)
committerCΓ©dric Villemain <cedric@2ndquadrant.fr>
Fri, 29 Jul 2011 09:50:12 +0000 (11:50 +0200)
adm64 wants %lld and i386 wants %ld for the int64 type.
So cast to (long long int) and use %lld in the printf expression.

ChangeLog
pgfincore.c

index d5e6eb1ebbd5b85290c4f2111bbca9850d7dafb7..a72a59a24d7e0d6fb8341d538243c244c93b5b11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 07/XX/2011 CΓ©dric Villemain <cedric@villemain.org>
   * 1.0.1 - Fix Makefile and remove the dir sql/ (useless and error prone)
+                 - Fix the printf of int64 by casting to long long int (i386 and
+                   adm64 behave differently with int64)
 
 07/28/2011 CΓ©dric Villemain <cedric@villemain.org>
   * 1.0.0 - Output varbit containing vector information with pgfincore*()
index 7164fc1f4c4eeed535144fb7d90334319fae591a..1842ceb140fb19e115bbb7b6090cd5750ef91da2 100644 (file)
@@ -220,8 +220,8 @@ pgfadvise_file(char *filename, int advice, pgfadviseStruct  *pgfdv)
         * the segment
         */
        pgfdv->filesize = st.st_size;
-       elog(DEBUG1, "pgfadvise: working on %s of %ld bytes",
-                filename, (int64) pgfdv->filesize);
+       elog(DEBUG1, "pgfadvise: working on %s of %lld bytes",
+                filename, (long long int) pgfdv->filesize);
 
        /* FADVISE_WILLNEED */
        if (advice == PGF_WILLNEED)
@@ -736,8 +736,8 @@ pgfincore_file(char *filename, pgfincoreStruct *pgfncr)
                        free(vec);
                        munmap(pa, st.st_size);
                        close(fd);
-                       elog(ERROR, "mincore(%p, %ld, %p): %s\n",
-                            pa, (int64)st.st_size, vec, strerror(errno));
+                       elog(ERROR, "mincore(%p, %lld, %p): %s\n",
+                            pa, (long long int)st.st_size, vec, strerror(errno));
                        return 5;
                }
 
@@ -765,8 +765,8 @@ pgfincore_file(char *filename, pgfincoreStruct *pgfncr)
                        {
                                pgfncr->pages_mem++;
                                *r |= x;
-                               elog (DEBUG5, "in memory blocks : %ld / %ld",
-                                     (int64) pageIndex, (int64) pgfncr->rel_os_pages);
+                               elog (DEBUG5, "in memory blocks : %lld / %lld",
+                                     (long long int) pageIndex, (long long int) pgfncr->rel_os_pages);
 
                                /* we flag to detect contigous blocks in the same state */
                                if (flag)
@@ -784,8 +784,8 @@ pgfincore_file(char *filename, pgfincoreStruct *pgfncr)
                        }
                }
        }
-       elog(DEBUG1, "pgfincore %s: %ld of %ld block in linux cache, %ld groups",
-            filename, (int64) pgfncr->pages_mem,  (int64) pgfncr->rel_os_pages, (int64) pgfncr->group_mem);
+       elog(DEBUG1, "pgfincore %s: %lld of %lld block in linux cache, %lld groups",
+            filename, (long long int) pgfncr->pages_mem,  (long long int) pgfncr->rel_os_pages, (long long int) pgfncr->group_mem);
 
        /*
         * free and close