Skip to content

Commit 14caf17

Browse files
committed
unify stdint type usage
if you need C99 stdint types, just include "php_stdint.h"
1 parent ca0497b commit 14caf17

24 files changed

+242
-271
lines changed

Makefile.global

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ clean:
120120
distclean: clean
121121
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
122122
rm -f php5.spec main/build-defs.h scripts/phpize
123-
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/mysqlnd/php_mysqlnd_config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
123+
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
124124
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
125125
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
126126
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h

acinclude.m4

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,3 +2978,22 @@ $ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
29782978
29792979
EOF
29802980
])
2981+
2982+
dnl
2983+
dnl PHP_CHECK_STDINT_TYPES
2984+
dnl
2985+
AC_DEFUN([PHP_CHECK_STDINT_TYPES], [
2986+
AC_CHECK_SIZEOF([short], 2)
2987+
AC_CHECK_SIZEOF([int], 4)
2988+
AC_CHECK_SIZEOF([long], 4)
2989+
AC_CHECK_SIZEOF([long long], 8)
2990+
AC_CHECK_TYPES([int8, int16, int32, int64, int8_t, int16_t, int32_t, int64_t, uint8, uint16, uint32, uint64, uint8_t, uint16_t, uint32_t, uint64_t, u_int8_t, u_int16_t, u_int32_t, u_int64_t], [], [], [
2991+
#if HAVE_STDINT_H
2992+
# include <stdint.h>
2993+
#endif
2994+
#if HAVE_SYS_TYPES_H
2995+
# include <sys/types.h>
2996+
#endif
2997+
])
2998+
AC_DEFINE([PHP_HAVE_STDINT_TYPES], [1], [Checked for stdint types])
2999+
])

configure.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ PHP_CHECK_SIZEOF(intmax_t, 0)
572572
PHP_CHECK_SIZEOF(ssize_t, 8)
573573
PHP_CHECK_SIZEOF(ptrdiff_t, 8)
574574

575+
dnl Check stdint types (must be after header check)
576+
PHP_CHECK_STDINT_TYPES
577+
575578
dnl Check for members of the stat structure
576579
AC_STRUCT_ST_BLKSIZE
577580
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists

ext/date/config0.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ cat > $ext_builddir/lib/timelib_config.h <<EOF
2222
#else
2323
# include <php_config.h>
2424
#endif
25+
#include <php_stdint.h>
2526
EOF

ext/date/lib/timelib_structs.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
#include <stdint.h>
3434
#endif
3535

36-
#ifdef PHP_WIN32
37-
/* TODO: Remove these hacks/defs once we have the int definitions in main/
38-
rathen than in each 2nd extension and win32/ */
39-
# include "win32/php_stdint.h"
40-
#else
4136
# ifndef HAVE_INT32_T
4237
# if SIZEOF_INT == 4
4338
typedef int int32_t;
@@ -53,7 +48,6 @@ typedef unsigned int uint32_t;
5348
typedef unsigned long int uint32_t;
5449
# endif
5550
# endif
56-
#endif
5751

5852
#include <stdio.h>
5953

@@ -68,8 +62,8 @@ typedef unsigned long int uint32_t;
6862
#endif
6963

7064
#if defined(_MSC_VER)
71-
typedef uint64_t timelib_ull;
72-
typedef int64_t timelib_sll;
65+
typedef __uint64 timelib_ull;
66+
typedef __int64 timelib_sll;
7367
# define TIMELIB_LL_CONST(n) n ## i64
7468
#else
7569
typedef unsigned long long timelib_ull;

ext/exif/exif.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@
4040
#include "php.h"
4141
#include "ext/standard/file.h"
4242

43-
#ifdef HAVE_STDINT_H
44-
# include <stdint.h>
45-
#endif
46-
#ifdef HAVE_INTTYPES_H
47-
# include <inttypes.h>
48-
#endif
49-
#ifdef PHP_WIN32
50-
# include "win32/php_stdint.h"
51-
#endif
52-
5343
#if HAVE_EXIF
5444

5545
/* When EXIF_DEBUG is defined the module generates a lot of debug messages

ext/hash/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if test "$PHP_HASH" != "no"; then
3131
EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \
3232
php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \
3333
php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \
34-
php_hash_fnv.h php_hash_joaat.h php_hash_types.h"
34+
php_hash_fnv.h php_hash_joaat.h"
3535

3636
PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared)
3737
ifdef([PHP_INSTALL_HEADERS], [

ext/hash/config.w32

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ if (PHP_HASH != "no") {
1919

2020
PHP_INSTALL_HEADERS("ext/hash/", "php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h " +
2121
"php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h " +
22-
"php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h " +
23-
"php_hash_types.h");
22+
"php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h");
2423
}
2524

ext/hash/package.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Supported Algorithms:
4242
<file role="src" name="config.w32"/>
4343
<file role="src" name="hash.c"/>
4444
<file role="src" name="php_hash.h"/>
45-
<file role="src" name="php_hash_types.h"/>
4645
<file role="src" name="hash_md.c"/>
4746
<file role="src" name="php_hash_md.h"/>
4847
<file role="src" name="hash_sha.c"/>

ext/hash/php_hash.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@
2222
#define PHP_HASH_H
2323

2424
#include "php.h"
25-
#include "php_hash_types.h"
2625

2726
#define PHP_HASH_EXTNAME "hash"
2827
#define PHP_HASH_EXTVER "1.0"
2928
#define PHP_HASH_RESNAME "Hash Context"
3029

3130
#define PHP_HASH_HMAC 0x0001
3231

32+
#define L64 INT64_C
33+
#define php_hash_int32 int32_t
34+
#define php_hash_uint32 uint32_t
35+
#define php_hash_int64 int64_t
36+
#define php_hash_uint64 uint64_t
37+
3338
typedef void (*php_hash_init_func_t)(void *context);
3439
typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count);
3540
typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context);

0 commit comments

Comments
 (0)