bpo-11063: Add a configure check for uuid_generate_time_safe (GH-4287)

This commit is contained in:
Berker Peksag 2017-11-08 23:09:16 +03:00 committed by GitHub
parent bf9d317626
commit 9a10ff4deb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 9 deletions

View file

@ -4,17 +4,10 @@
#include <uuid/uuid.h>
/* bpo-11063: libuuid on macOS doesn't provide uuid_generate_time_safe(),
only uuid_generate_time(). */
#ifndef __APPLE__
# define HAVE_TIME_SAFE
#endif
static PyObject *
py_uuid_generate_time_safe(void)
{
#ifdef HAVE_TIME_SAFE
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
uuid_t out;
int res;
@ -45,7 +38,7 @@ PyInit__uuid(void)
{
PyObject *mod;
assert(sizeof(uuid_t) == 16);
#ifdef HAVE_TIME_SAFE
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
int has_uuid_generate_time_safe = 1;
#else
int has_uuid_generate_time_safe = 0;