mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-32399: Starting with AIX6.1 there is support in libc.a for uuid (RFC4122) (#4974)
Starting with AIX6.1 there is support in libc.a for uuid (RFC4122) This patch provides the changes needed for this integration with the OS. On AIX the base function is uuid_create() rather than uuid_generate_time() The AIX uuid_t typedef is more aligned to the UUID field based definition while the Linux typedef that is more aligned with UUID bytes (or perhaps UUID bytes_le) definitions.
This commit is contained in:
parent
0c36bed1c4
commit
0d3ccb4395
5 changed files with 88 additions and 6 deletions
|
@ -1,22 +1,33 @@
|
|||
#define PY_SSIZE_T_CLEAN
|
||||
|
||||
#include "Python.h"
|
||||
#ifdef HAVE_UUID_UUID_H
|
||||
#include <uuid/uuid.h>
|
||||
#endif
|
||||
#ifdef HAVE_UUID_H
|
||||
#include <uuid.h>
|
||||
#endif
|
||||
|
||||
|
||||
static PyObject *
|
||||
py_uuid_generate_time_safe(void)
|
||||
{
|
||||
uuid_t uuid;
|
||||
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
|
||||
uuid_t out;
|
||||
int res;
|
||||
|
||||
res = uuid_generate_time_safe(out);
|
||||
return Py_BuildValue("y#i", (const char *) out, sizeof(out), res);
|
||||
res = uuid_generate_time_safe(uuid);
|
||||
return Py_BuildValue("y#i", (const char *) uuid, sizeof(uuid), res);
|
||||
#elif HAVE_UUID_CREATE
|
||||
/*
|
||||
* AIX support for uuid - RFC4122
|
||||
*/
|
||||
unsigned32 status;
|
||||
uuid_create(&uuid, &status);
|
||||
return Py_BuildValue("y#i", (const char *) &uuid, sizeof(uuid), (int) status);
|
||||
#else
|
||||
uuid_t out;
|
||||
uuid_generate_time(out);
|
||||
return Py_BuildValue("y#O", (const char *) out, sizeof(out), Py_None);
|
||||
uuid_generate_time(uuid);
|
||||
return Py_BuildValue("y#O", (const char *) uuid, sizeof(uuid), Py_None);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue