Redefine Datum as uintptr_t, instead of unsigned long.
authorTom Lane <[email protected]>
Thu, 31 Dec 2009 19:41:37 +0000 (19:41 +0000)
committerTom Lane <[email protected]>
Thu, 31 Dec 2009 19:41:37 +0000 (19:41 +0000)
This is more in keeping with modern practice, and is a first step towards
porting to Win64 (which has sizeof(pointer) > sizeof(long)).

Tsutomu Yamada, Magnus Hagander, Tom Lane

16 files changed:
configure
configure.in
src/backend/access/common/heaptuple.c
src/backend/access/hash/hashfunc.c
src/backend/port/hpux/tas.c.template
src/backend/storage/lmgr/lwlock.c
src/backend/utils/misc/guc.c
src/include/access/tupmacs.h
src/include/c.h
src/include/pg_config.h.in
src/include/pg_config.h.win32
src/include/postgres.h
src/include/storage/s_lock.h
src/interfaces/ecpg/ecpglib/data.c
src/pl/plperl/plperl.c
src/pl/tcl/pltcl.c

index 009a177b088de419133fb98f6c6c6584995e5302..d4644d92ad77d755eceefdfd1b241a18f25c37a3 100755 (executable)
--- a/configure
+++ b/configure
@@ -677,6 +677,7 @@ python_libdir
 python_includespec
 python_configdir
 python_version
+python_majorversion
 PYTHON
 perl_embed_ldflags
 perl_useshrplib
@@ -6964,6 +6965,7 @@ $as_echo "$as_me: error: distutils module not found" >&2;}
 fi
 { $as_echo "$as_me:$LINENO: checking Python configuration directory" >&5
 $as_echo_n "checking Python configuration directory... " >&6; }
+python_majorversion=`${PYTHON} -c "import sys; print(sys.version[0])"`
 python_version=`${PYTHON} -c "import sys; print(sys.version[:3])"`
 python_configdir=`${PYTHON} -c "from distutils.sysconfig import get_python_lib as f; import os; print(os.path.join(f(plat_specific=1,standard_lib=1),'config'))"`
 python_includespec=`${PYTHON} -c "import distutils.sysconfig; print('-I'+distutils.sysconfig.get_python_inc())"`
@@ -16024,6 +16026,321 @@ _ACEOF
 fi
 
 
+  { $as_echo "$as_me:$LINENO: checking for intptr_t" >&5
+$as_echo_n "checking for intptr_t... " >&6; }
+if test "${ac_cv_type_intptr_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_intptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (intptr_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+    test -z "$ac_c_werror_flag" ||
+    test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((intptr_t)))
+     return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+    test -z "$ac_c_werror_flag" ||
+    test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+   ac_cv_type_intptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
+$as_echo "$ac_cv_type_intptr_t" >&6; }
+if test "x$ac_cv_type_intptr_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTPTR_T 1
+_ACEOF
+
+else
+  for ac_type in 'int' 'long int' 'long long int'; do
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+    test -z "$ac_c_werror_flag" ||
+    test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<_ACEOF
+#define intptr_t $ac_type
+_ACEOF
+
+     ac_type=
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       test -z "$ac_type" && break
+     done
+fi
+
+
+
+  { $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5
+$as_echo_n "checking for uintptr_t... " >&6; }
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_uintptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (uintptr_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+    test -z "$ac_c_werror_flag" ||
+    test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((uintptr_t)))
+     return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+    test -z "$ac_c_werror_flag" ||
+    test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+   ac_cv_type_uintptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+$as_echo "$ac_cv_type_uintptr_t" >&6; }
+if test "x$ac_cv_type_uintptr_t" = x""yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+else
+  for ac_type in 'unsigned int' 'unsigned long int' \
+   'unsigned long long int'; do
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+    test -z "$ac_c_werror_flag" ||
+    test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t $ac_type
+_ACEOF
+
+     ac_type=
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       test -z "$ac_type" && break
+     done
+fi
+
+
+
 { $as_echo "$as_me:$LINENO: checking for struct cmsgcred" >&5
 $as_echo_n "checking for struct cmsgcred... " >&6; }
 if test "${ac_cv_type_struct_cmsgcred+set}" = set; then
@@ -22537,14 +22854,14 @@ esac
 
 fi
 
-# Need a #define for the size of Datum (unsigned long)
+# Check size of void *, size_t (enables tweaks for > 32bit address space)
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of unsigned long" >&5
-$as_echo_n "checking size of unsigned long... " >&6; }
-if test "${ac_cv_sizeof_unsigned_long+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if test "${ac_cv_sizeof_void_p+set}" = set; then
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
@@ -22559,7 +22876,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -22596,7 +22913,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -22650,7 +22967,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
 test_array [0] = 0
 
   ;
@@ -22687,7 +23004,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -22751,7 +23068,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned long))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
-?*) ac_cv_sizeof_unsigned_long=$ac_lo;;
-'') if test "$ac_cv_type_unsigned_long" = yes; then
+?*) ac_cv_sizeof_void_p=$ac_lo;;
+'') if test "$ac_cv_type_void_p" = yes; then
      { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
 See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (unsigned long)
+$as_echo "$as_me: error: cannot compute sizeof (void *)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_unsigned_long=0
+     ac_cv_sizeof_void_p=0
    fi ;;
 esac
 else
@@ -22808,8 +23125,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-static long int longval () { return (long int) (sizeof (unsigned long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (unsigned long)); }
+static long int longval () { return (long int) (sizeof (void *)); }
+static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -22819,17 +23136,17 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (unsigned long))) < 0)
+  if (((long int) (sizeof (void *))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (unsigned long))))
+      if (i != ((long int) (sizeof (void *))))
    return 1;
       fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (unsigned long))))
+      if (i != ((long int) (sizeof (void *))))
    return 1;
       fprintf (f, "%lu", i);
     }
@@ -22863,23 +23180,23 @@ $as_echo "$ac_try_echo") >&5
   ac_status=$?
   $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_sizeof_unsigned_long=`cat conftest.val`
+  ac_cv_sizeof_void_p=`cat conftest.val`
 else
   $as_echo "$as_me: program exited with status $ac_status" >&5
 $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_unsigned_long" = yes; then
+if test "$ac_cv_type_void_p" = yes; then
      { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
 See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (unsigned long)
+$as_echo "$as_me: error: cannot compute sizeof (void *)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_unsigned_long=0
+     ac_cv_sizeof_void_p=0
    fi
 fi
 rm -rf conftest.dSYM
@@ -22887,25 +23204,23 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
 fi
 rm -f conftest.val
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5
-$as_echo "$ac_cv_sizeof_unsigned_long" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
 _ACEOF
 
 
-
-# And check size of void *, size_t (enables tweaks for > 32bit address space)
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if test "${ac_cv_sizeof_void_p+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5
+$as_echo_n "checking size of size_t... " >&6; }
+if test "${ac_cv_sizeof_size_t+set}" = set; then
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
@@ -22920,7 +23235,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -22957,7 +23272,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -23011,7 +23326,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
 test_array [0] = 0
 
   ;
@@ -23048,7 +23363,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -23112,7 +23427,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
-?*) ac_cv_sizeof_void_p=$ac_lo;;
-'') if test "$ac_cv_type_void_p" = yes; then
+?*) ac_cv_sizeof_size_t=$ac_lo;;
+'') if test "$ac_cv_type_size_t" = yes; then
      { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
+$as_echo "$as_me: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_void_p=0
+     ac_cv_sizeof_size_t=0
    fi ;;
 esac
 else
@@ -23169,8 +23484,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-static long int longval () { return (long int) (sizeof (void *)); }
-static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
+static long int longval () { return (long int) (sizeof (size_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -23180,17 +23495,17 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (void *))) < 0)
+  if (((long int) (sizeof (size_t))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (void *))))
+      if (i != ((long int) (sizeof (size_t))))
    return 1;
       fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (void *))))
+      if (i != ((long int) (sizeof (size_t))))
    return 1;
       fprintf (f, "%lu", i);
     }
@@ -23224,23 +23539,23 @@ $as_echo "$ac_try_echo") >&5
   ac_status=$?
   $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_sizeof_void_p=`cat conftest.val`
+  ac_cv_sizeof_size_t=`cat conftest.val`
 else
   $as_echo "$as_me: program exited with status $ac_status" >&5
 $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_void_p" = yes; then
+if test "$ac_cv_type_size_t" = yes; then
      { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
+$as_echo "$as_me: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_void_p=0
+     ac_cv_sizeof_size_t=0
    fi
 fi
 rm -rf conftest.dSYM
@@ -23248,13 +23563,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
 fi
 rm -f conftest.val
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5
+$as_echo "$ac_cv_sizeof_size_t" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
 _ACEOF
 
 
@@ -23262,9 +23577,9 @@ _ACEOF
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5
-$as_echo_n "checking size of size_t... " >&6; }
-if test "${ac_cv_sizeof_size_t+set}" = set; then
+{ $as_echo "$as_me:$LINENO: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then
   $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
@@ -23279,7 +23594,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -23316,7 +23631,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -23370,7 +23685,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
 test_array [0] = 0
 
   ;
@@ -23407,7 +23722,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -23471,7 +23786,7 @@ $ac_includes_default
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
-?*) ac_cv_sizeof_size_t=$ac_lo;;
-'') if test "$ac_cv_type_size_t" = yes; then
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
      { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
+$as_echo "$as_me: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_size_t=0
+     ac_cv_sizeof_long=0
    fi ;;
 esac
 else
@@ -23528,8 +23843,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-static long int longval () { return (long int) (sizeof (size_t)); }
-static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
+static long int longval () { return (long int) (sizeof (long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -23539,17 +23854,17 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (size_t))) < 0)
+  if (((long int) (sizeof (long))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (size_t))))
+      if (i != ((long int) (sizeof (long))))
    return 1;
       fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (size_t))))
+      if (i != ((long int) (sizeof (long))))
    return 1;
       fprintf (f, "%lu", i);
     }
@@ -23583,23 +23898,23 @@ $as_echo "$ac_try_echo") >&5
   ac_status=$?
   $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_sizeof_size_t=`cat conftest.val`
+  ac_cv_sizeof_long=`cat conftest.val`
 else
   $as_echo "$as_me: program exited with status $ac_status" >&5
 $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_size_t" = yes; then
+if test "$ac_cv_type_long" = yes; then
      { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (size_t)
+$as_echo "$as_me: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_size_t=0
+     ac_cv_sizeof_long=0
    fi
 fi
 rm -rf conftest.dSYM
@@ -23607,13 +23922,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
 fi
 rm -f conftest.val
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5
-$as_echo "$ac_cv_sizeof_size_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t
+#define SIZEOF_LONG $ac_cv_sizeof_long
 _ACEOF
 
 
@@ -23670,7 +23985,7 @@ _ACEOF
 # If not, trying to select it is an error.
 { $as_echo "$as_me:$LINENO: checking whether to build with float8 passed by value" >&5
 $as_echo_n "checking whether to build with float8 passed by value... " >&6; }
-if test $ac_cv_sizeof_unsigned_long -ge 8 ; then
+if test $ac_cv_sizeof_void_p -ge 8 ; then
 
 
 # Check whether --enable-float8-byval was given.
index d875571f1ad1e9b0a01200434ce43c8536ace067..d29901fbfb0fd6c19f8d35307297a4fcaf913e60 100644 (file)
@@ -1095,6 +1095,8 @@ PGAC_STRUCT_SOCKADDR_UN
 PGAC_STRUCT_SOCKADDR_STORAGE
 PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
 PGAC_STRUCT_ADDRINFO
+AC_TYPE_INTPTR_T
+AC_TYPE_UINTPTR_T
 
 AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
 [#include <sys/param.h>
@@ -1555,12 +1557,10 @@ if test $pgac_need_repl_snprintf = yes; then
   AC_LIBOBJ(snprintf)
 fi
 
-# Need a #define for the size of Datum (unsigned long)
-AC_CHECK_SIZEOF([unsigned long])
-
-# And check size of void *, size_t (enables tweaks for > 32bit address space)
+# Check size of void *, size_t (enables tweaks for > 32bit address space)
 AC_CHECK_SIZEOF([void *])
 AC_CHECK_SIZEOF([size_t])
+AC_CHECK_SIZEOF([long])
 
 # Decide whether float4 is passed by value: user-selectable, enabled by default
 AC_MSG_CHECKING([whether to build with float4 passed by value])   
@@ -1577,7 +1577,7 @@ AC_DEFINE_UNQUOTED([FLOAT4PASSBYVAL], [$float4passbyval], [float4 values are pas
 # If sizeof(Datum) >= 8, this is user-selectable, enabled by default.
 # If not, trying to select it is an error.
 AC_MSG_CHECKING([whether to build with float8 passed by value])
-if test $ac_cv_sizeof_unsigned_long -ge 8 ; then
+if test $ac_cv_sizeof_void_p -ge 8 ; then
   PGAC_ARG_BOOL(enable, float8-byval, yes, [disable float8 passed by value])
 else
   PGAC_ARG_BOOL(enable, float8-byval, no, [disable float8 passed by value])
index a86716e3af90ee85f1ff59a74ab7e3e35f5d3320..f429f683d976fc8338413182f7b314fc0458a435 100644 (file)
@@ -192,7 +192,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
        if (att[i]->attbyval)
        {
            /* pass-by-value */
-           data = (char *) att_align_nominal((long) data, att[i]->attalign);
+           data = (char *) att_align_nominal(data, att[i]->attalign);
            store_att_byval(data, values[i], att[i]->attlen);
            data_length = att[i]->attlen;
        }
@@ -226,7 +226,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
            else
            {
                /* full 4-byte header varlena */
-               data = (char *) att_align_nominal((long) data,
+               data = (char *) att_align_nominal(data,
                                                  att[i]->attalign);
                data_length = VARSIZE(val);
                memcpy(data, val, data_length);
@@ -243,7 +243,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
        else
        {
            /* fixed-length pass-by-reference */
-           data = (char *) att_align_nominal((long) data, att[i]->attalign);
+           data = (char *) att_align_nominal(data, att[i]->attalign);
            Assert(att[i]->attlen > 0);
            data_length = att[i]->attlen;
            memcpy(data, DatumGetPointer(values[i]), data_length);
index a38103eaf1d12640b1de5ccd4f69829eb0dbfb79..d3efb29c508b2797ab1218b68afae5782e304d69 100644 (file)
@@ -319,7 +319,7 @@ hash_any(register const unsigned char *k, register int keylen)
    a = b = c = 0x9e3779b9 + len + 3923095;
 
    /* If the source pointer is word-aligned, we use word-wide fetches */
-   if (((long) k & UINT32_ALIGN_MASK) == 0)
+   if (((intptr_t) k & UINT32_ALIGN_MASK) == 0)
    {
        /* Code path for aligned source data */
        register const uint32 *ka = (const uint32 *) k;
index 45782948df6c0ef365fe3222e99265ea203717ed..5ccbbcde9aa415b02188270032253d63c2f7a19a 100644 (file)
@@ -20,7 +20,7 @@ tas(lock)
      * LDCWX requires that we align the "semaphore" to a 16-byte
      * boundary.  The actual datum is a single word (4 bytes).
      */
-    lock = ((long) lock + 15) & ~15;
+    lock = ((uintptr_t) lock + 15) & ~15;
 
     /*
      * The LDCWX instruction atomically clears the target word and
index f2ccbe14e7cc8b4ec767b93830440d04ab243625..5d88b020e553383400c13167cbc2e860fcd2ba99 100644 (file)
@@ -245,7 +245,7 @@ CreateLWLocks(void)
    ptr += 2 * sizeof(int);
 
    /* Ensure desired alignment of LWLock array */
-   ptr += LWLOCK_PADDED_SIZE - ((unsigned long) ptr) % LWLOCK_PADDED_SIZE;
+   ptr += LWLOCK_PADDED_SIZE - ((uintptr_t) ptr) % LWLOCK_PADDED_SIZE;
 
    LWLockArray = (LWLockPadded *) ptr;
 
index b5307201ed8e37fad14b26402dbdc765dc4f4a8e..8c0b6b0ea14d3f9c7614c30b7798e0097212896c 100644 (file)
@@ -87,7 +87,8 @@
 #endif
 
 /* upper limit for GUC variables measured in kilobytes of memory */
-#if SIZEOF_SIZE_T > 4
+/* note that various places assume the byte size fits in a "long" variable */
+#if SIZEOF_SIZE_T > 4 && SIZEOF_LONG > 4
 #define MAX_KILOBYTES  INT_MAX
 #else
 #define MAX_KILOBYTES  (INT_MAX / 1024)
index 7666aaa9ff1d0a49f5098f2a48fac8fe834311e9..26a2dd9d1151788ea92f572687461441b48a0026 100644 (file)
  */
 #define att_align_datum(cur_offset, attalign, attlen, attdatum) \
 ( \
-   ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? (long) (cur_offset) : \
+   ((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \
+   (intptr_t) (cur_offset) : \
    att_align_nominal(cur_offset, attalign) \
 )
 
  * aligned 4-byte length word; in either case we need not align.)
  *
  * Note: some callers pass a "char *" pointer for cur_offset.  This is
- * a bit of a hack but works OK on all known platforms.  It ought to be
- * cleaned up someday, though.
+ * a bit of a hack but should work all right as long as intptr_t is the
+ * correct width.
  */
 #define att_align_pointer(cur_offset, attalign, attlen, attptr) \
 ( \
-   ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? (long) (cur_offset) : \
+   ((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \
+   (intptr_t) (cur_offset) : \
    att_align_nominal(cur_offset, attalign) \
 )
 
 #define att_align_nominal(cur_offset, attalign) \
 ( \
    ((attalign) == 'i') ? INTALIGN(cur_offset) : \
-    (((attalign) == 'c') ? (long) (cur_offset) : \
+    (((attalign) == 'c') ? (intptr_t) (cur_offset) : \
      (((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \
       ( \
            AssertMacro((attalign) == 's'), \
index 44efac4275de9ee96cd054a0da8572a9c01eb71e..acaec39d637814067333b9a5b65f2aba77d89c59 100644 (file)
@@ -72,6 +72,9 @@
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 #include <sys/types.h>
 
 #include <errno.h>
@@ -492,7 +495,7 @@ typedef NameData *Name;
  *     True iff pointer is properly aligned to point to the given type.
  */
 #define PointerIsAligned(pointer, type) \
-       (((long)(pointer) % (sizeof (type))) == 0)
+       (((intptr_t)(pointer) % (sizeof (type))) == 0)
 
 #define OidIsValid(objectId)  ((bool) ((objectId) != InvalidOid))
 
@@ -538,7 +541,7 @@ typedef NameData *Name;
  */
 
 #define TYPEALIGN(ALIGNVAL,LEN)  \
-   (((long) (LEN) + ((ALIGNVAL) - 1)) & ~((long) ((ALIGNVAL) - 1)))
+   (((intptr_t) (LEN) + ((ALIGNVAL) - 1)) & ~((intptr_t) ((ALIGNVAL) - 1)))
 
 #define SHORTALIGN(LEN)            TYPEALIGN(ALIGNOF_SHORT, (LEN))
 #define INTALIGN(LEN)          TYPEALIGN(ALIGNOF_INT, (LEN))
@@ -549,7 +552,7 @@ typedef NameData *Name;
 #define BUFFERALIGN(LEN)       TYPEALIGN(ALIGNOF_BUFFER, (LEN))
 
 #define TYPEALIGN_DOWN(ALIGNVAL,LEN)  \
-   (((long) (LEN)) & ~((long) ((ALIGNVAL) - 1)))
+   (((intptr_t) (LEN)) & ~((intptr_t) ((ALIGNVAL) - 1)))
 
 #define SHORTALIGN_DOWN(LEN)   TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN))
 #define INTALIGN_DOWN(LEN)     TYPEALIGN_DOWN(ALIGNOF_INT, (LEN))
@@ -630,7 +633,7 @@ typedef NameData *Name;
        int     _val = (val); \
        Size    _len = (len); \
 \
-       if ((((long) _vstart) & LONG_ALIGN_MASK) == 0 && \
+       if ((((intptr_t) _vstart) & LONG_ALIGN_MASK) == 0 && \
            (_len & LONG_ALIGN_MASK) == 0 && \
            _val == 0 && \
            _len <= MEMSET_LOOP_LIMIT && \
index 1af24681fd747fd2cf448b15922534f892eb4dcb..a3a80f053b94a0bed0a4aa37c427ff9554b61071 100644 (file)
 /* Define to 1 if the system has the type `int8'. */
 #undef HAVE_INT8
 
+/* Define to 1 if the system has the type `intptr_t'. */
+#undef HAVE_INTPTR_T
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
 /* Define to 1 if the system has the type `uint8'. */
 #undef HAVE_UINT8
 
+/* Define to 1 if the system has the type `uintptr_t'. */
+#undef HAVE_UINTPTR_T
+
 /* Define to 1 if the system has the type `union semun'. */
 #undef HAVE_UNION_SEMUN
 
    RELSEG_SIZE requires an initdb. */
 #undef RELSEG_SIZE
 
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
 /* The size of `off_t', as computed by sizeof. */
 #undef SIZEOF_OFF_T
 
 /* The size of `size_t', as computed by sizeof. */
 #undef SIZEOF_SIZE_T
 
-/* The size of `unsigned long', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_LONG
-
 /* The size of `void *', as computed by sizeof. */
 #undef SIZEOF_VOID_P
 
 #undef inline
 #endif
 
+/* Define to the type of a signed integer type wide enough to hold a pointer,
+   if such a type exists, and if the system does not define it. */
+#undef intptr_t
+
 /* Define to empty if the C compiler does not understand signed types. */
 #undef signed
 
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+#undef uintptr_t
+
 /* Define to empty if the keyword `volatile' does not work. Warning: valid
    code using `volatile' can become incorrect without. Disable with care. */
 #undef volatile
index a3b3b7374b05d43b36f0e1e5a902dd2d515c092c..573a53edb86cb9d9fc1c299e043471dd16b818f5 100644 (file)
 /* #undef HAVE_SRANDOM */
 
 /* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
+/* #undef HAVE_STDINT_H */
 
 /* Define to 1 if you have the <stdlib.h> header file. */
 #define HAVE_STDLIB_H 1
    your system. */
 /* #undef PTHREAD_CREATE_JOINABLE */
 
-/* The size of a `size_t', as computed by sizeof. */
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of `size_t', as computed by sizeof. */
 #define SIZEOF_SIZE_T 4
 
-/* The size of a `unsigned long', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG 4
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 4
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
index 26dfecc7763895092a24d50a37d7611fb2b67931..1b063e159e8078438dacb71930be553e2dca9315 100644 (file)
@@ -285,16 +285,10 @@ typedef struct
 
 /*
  * Port Notes:
- * Postgres makes the following assumption about machines:
- *
- * sizeof(Datum) == sizeof(long) >= sizeof(void *) >= 4
- *
- * Postgres also assumes that
+ * Postgres makes the following assumptions about datatype sizes:
  *
+ * sizeof(Datum) == sizeof(void *) == 4 or 8
  * sizeof(char) == 1
- *
- * and that
- *
  * sizeof(short) == 2
  *
  * When a type narrower than Datum is stored in a Datum, we place it in the
@@ -305,9 +299,9 @@ typedef struct
  * or short may contain garbage when called as if it returned Datum.
  */
 
-typedef unsigned long Datum;   /* XXX sizeof(long) >= sizeof(void *) */
+typedef uintptr_t Datum;
 
-#define SIZEOF_DATUM SIZEOF_UNSIGNED_LONG
+#define SIZEOF_DATUM SIZEOF_VOID_P
 
 typedef Datum *DatumPtr;
 
index 48208b9db750e938793344c3fe94f910bf16c368..5b4115da8b709cd734e63a8f09bd85769f6df026 100644 (file)
@@ -683,7 +683,7 @@ typedef struct
    int         sema[4];
 } slock_t;
 
-#define TAS_ACTIVE_WORD(lock)  ((volatile int *) (((long) (lock) + 15) & ~15))
+#define TAS_ACTIVE_WORD(lock)  ((volatile int *) (((uintptr_t) (lock) + 15) & ~15))
 
 #if defined(__GNUC__)
 
index d468de6fdc10f9191b3d00202ce6df93bf05dcdc..27bab00d59ae45c148fb9d0007f147dbb25140c7 100644 (file)
@@ -162,12 +162,10 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
        if (binary)
        {
            if (varcharsize == 0 || varcharsize * offset >= size)
-               memcpy((char *) ((long) var + offset * act_tuple),
-                      pval, size);
+               memcpy(var + offset * act_tuple, pval, size);
            else
            {
-               memcpy((char *) ((long) var + offset * act_tuple),
-                      pval, varcharsize * offset);
+               memcpy(var + offset * act_tuple, pval, varcharsize * offset);
 
                if (varcharsize * offset < size)
                {
@@ -371,7 +369,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                case ECPGt_unsigned_char:
                case ECPGt_string:
                    {
-                       char    *str = (char *) ((long) var + offset * act_tuple);
+                       char    *str = (char *) (var + offset * act_tuple);
                        if (varcharsize == 0 || varcharsize > size)
                        {
                            strncpy(str, pval, size + 1);
@@ -426,7 +424,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                case ECPGt_varchar:
                    {
                        struct ECPGgeneric_varchar *variable =
-                       (struct ECPGgeneric_varchar *) ((long) var + offset * act_tuple);
+                       (struct ECPGgeneric_varchar *) (var + offset * act_tuple);
 
                        variable->len = size;
                        if (varcharsize == 0)
index d200a4f56c197d3c0ddb0a0b8a8db1b3a5765a55..d6199d35fa1ddd2cf62c90a1217116695d270c2c 100644 (file)
@@ -95,7 +95,7 @@ typedef struct plperl_call_data
  **********************************************************************/
 typedef struct plperl_query_desc
 {
-   char        qname[sizeof(long) * 2 + 1];
+   char        qname[20];
    void       *plan;
    int         nargs;
    Oid        *argtypes;
@@ -2337,7 +2337,7 @@ plperl_spi_prepare(char *query, int argc, SV **argv)
     ************************************************************/
    qdesc = (plperl_query_desc *) malloc(sizeof(plperl_query_desc));
    MemSet(qdesc, 0, sizeof(plperl_query_desc));
-   snprintf(qdesc->qname, sizeof(qdesc->qname), "%lx", (long) qdesc);
+   snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
    qdesc->nargs = argc;
    qdesc->argtypes = (Oid *) malloc(argc * sizeof(Oid));
    qdesc->arginfuncs = (FmgrInfo *) malloc(argc * sizeof(FmgrInfo));
index 55d6867b1d1b01b001fe4a79809d581ccbe6ff95..260302840649490e388f166b39692715275ebc1c 100644 (file)
@@ -1946,7 +1946,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
     * Allocate the new querydesc structure
     ************************************************************/
    qdesc = (pltcl_query_desc *) malloc(sizeof(pltcl_query_desc));
-   snprintf(qdesc->qname, sizeof(qdesc->qname), "%lx", (long) qdesc);
+   snprintf(qdesc->qname, sizeof(qdesc->qname), "%p", qdesc);
    qdesc->nargs = nargs;
    qdesc->argtypes = (Oid *) malloc(nargs * sizeof(Oid));
    qdesc->arginfuncs = (FmgrInfo *) malloc(nargs * sizeof(FmgrInfo));