Re: com php-src: Fixes to unified stdint usage: ext/date/lib/timelib_structs.h main/php_stdint.h
| From: | Derick Rethans | Date: | Tue, 20 Jan 2015 21:08:05 +0000 |
| Subject: | Re: com php-src: Fixes to unified stdint usage: ext/date/lib/timelib_structs.h main/php_stdint.h | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-84231@lists.php.net to get a copy of this message | ||
Hi Anatol!
(Yes, I realise this is from more than a year ago)
This commit makes timelib include a PHP specific file. timelib also
lives as an external library (https://github.com/derickr/timelib) and is
used by other projects. Because it's sort of an external library, we
can't include PHP's headers (php_stdint.h) in this case.
How do you suppose we can fix this? Right now, I can't easily test
changes to the date/time parser (as they require *just* the lib).
cheers,
Derick
On Mon, 12 Aug 2013, Anatol Belski wrote:
> Commit: acea91b18c26149f753a037b96bed9e2b61bfdd1
> Author: Anatol Belski <ab@php.net> Mon, 12 Aug 2013 13:39:17 +0200
> Parents: 52dac3e8cda94c8f38287ec3c437d9450b31b527
> Branches: master
>
> Link:
> http://git.php.net/?p=php-src.git;a=commitdiff;h=acea91b18c26149f753a037b96bed9e2b61bfdd1
>
> Log:
> Fixes to unified stdint usage
>
> This recalls 14caf174ff219376e4f1234bd297ffe973cc416e
>
> Changed paths:
> M ext/date/lib/timelib_structs.h
> M main/php_stdint.h
>
>
> Diff:
> diff --git a/ext/date/lib/timelib_structs.h b/ext/date/lib/timelib_structs.h
> index 5d1d963..cc12eb3 100644
> --- a/ext/date/lib/timelib_structs.h
> +++ b/ext/date/lib/timelib_structs.h
> @@ -23,31 +23,7 @@
>
> #include "timelib_config.h"
>
> -#ifdef HAVE_SYS_TYPES_H
> -#include <sys/types.h>
> -#endif
> -
> -#if defined(HAVE_INTTYPES_H)
> -#include <inttypes.h>
> -#elif defined(HAVE_STDINT_H)
> -#include <stdint.h>
> -#endif
> -
> -# ifndef HAVE_INT32_T
> -# if SIZEOF_INT == 4
> -typedef int int32_t;
> -# elif SIZEOF_LONG == 4
> -typedef long int int32_t;
> -# endif
> -# endif
> -
> -# ifndef HAVE_UINT32_T
> -# if SIZEOF_INT == 4
> -typedef unsigned int uint32_t;
> -# elif SIZEOF_LONG == 4
> -typedef unsigned long int uint32_t;
> -# endif
> -# endif
> +#include "php_stdint.h"
>
> #include <stdio.h>
>
> @@ -62,8 +38,8 @@ typedef unsigned long int uint32_t;
> #endif
>
> #if defined(_MSC_VER)
> -typedef __uint64 timelib_ull;
> -typedef __int64 timelib_sll;
> +typedef uint64_t timelib_ull;
> +typedef int64_t timelib_sll;
> # define TIMELIB_LL_CONST(n) n ## i64
> #else
> typedef unsigned long long timelib_ull;
> diff --git a/main/php_stdint.h b/main/php_stdint.h
> index c8300d9..87edb0f 100644
> --- a/main/php_stdint.h
> +++ b/main/php_stdint.h
> @@ -19,8 +19,16 @@
> #ifndef PHP_STDINT_H
> #define PHP_STDINT_H
>
> -#if PHP_WIN32
> -# include "win32/php_stdint.h"
> +#if defined(_MSC_VER)
> +/* Make sure the regular stdint.h wasn't included already and prevent it to be
> + included afterwards. Though if some other library needs some stuff from
> + stdint.h included afterwards and misses it, we'd have to extend ours. On
> + the other hand, if stdint.h was included before, some conflicts might
> + happen so we'd likewise have to fix ours. */
> +# if !defined(_STDINT)
> +# define _STDINT
> +# include "win32/php_stdint.h"
> +# endif
> # define HAVE_INT8_T 1
> # define HAVE_UINT8_T 1
> # define HAVE_INT16_T 1
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine