File tree Expand file tree Collapse file tree 5 files changed +61
-1
lines changed
Filter options
Expand file tree Collapse file tree 5 files changed +61
-1
lines changed
Original file line number Diff line number Diff line change
1
+ Fixed :func: `uuid.uuid1 ` on FreeBSD.
Original file line number Diff line number Diff line change @@ -18,10 +18,16 @@ py_uuid_generate_time_safe(void)
18
18
19
19
res = uuid_generate_time_safe (uuid );
20
20
return Py_BuildValue ("y#i" , (const char * ) uuid , sizeof (uuid ), res );
21
- #elif HAVE_UUID_CREATE
21
+ #elif defined( HAVE_UUID_CREATE )
22
22
uint32_t status ;
23
23
uuid_create (& uuid , & status );
24
+ # if defined(HAVE_UUID_ENC_BE )
25
+ unsigned char buf [sizeof (uuid )];
26
+ uuid_enc_be (buf , & uuid );
27
+ return Py_BuildValue ("y#i" , buf , sizeof (uuid ), (int ) status );
28
+ # else
24
29
return Py_BuildValue ("y#i" , (const char * ) & uuid , sizeof (uuid ), (int ) status );
30
+ # endif
25
31
#else
26
32
uuid_generate_time (uuid );
27
33
return Py_BuildValue ("y#O" , (const char * ) uuid , sizeof (uuid ), Py_None );
@@ -57,6 +63,7 @@ PyInit__uuid(void)
57
63
}
58
64
if (PyModule_AddIntConstant (mod , "has_uuid_generate_time_safe" ,
59
65
has_uuid_generate_time_safe ) < 0 ) {
66
+ Py_DECREF (mod );
60
67
return NULL ;
61
68
}
62
69
Original file line number Diff line number Diff line change @@ -9625,6 +9625,40 @@ $as_echo "no" >&6; }
9625
9625
fi
9626
9626
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9627
9627
9628
+ # Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet
9629
+ # stream in big-endian byte-order
9630
+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for uuid_enc_be" >&5
9631
+ $as_echo_n " checking for uuid_enc_be... " >&6 ; }
9632
+ cat confdefs.h - << _ACEOF >conftest.$ac_ext
9633
+ /* end confdefs.h. */
9634
+ #include <uuid.h>
9635
+ int
9636
+ main ()
9637
+ {
9638
+
9639
+ #ifndef uuid_enc_be
9640
+ uuid_t uuid;
9641
+ unsigned char buf[sizeof(uuid)];
9642
+ uuid_enc_be(buf, &uuid);
9643
+ #endif
9644
+
9645
+ ;
9646
+ return 0;
9647
+ }
9648
+ _ACEOF
9649
+ if ac_fn_c_try_compile " $LINENO " ; then :
9650
+
9651
+ $as_echo " #define HAVE_UUID_ENC_BE 1" >> confdefs.h
9652
+
9653
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: yes" >&5
9654
+ $as_echo " yes" >&6 ; }
9655
+ else
9656
+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
9657
+ $as_echo " no" >&6 ; }
9658
+
9659
+ fi
9660
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9661
+
9628
9662
# 'Real Time' functions on Solaris
9629
9663
# posix4 on Solaris 2.6
9630
9664
# pthread (first!) on Linux
Original file line number Diff line number Diff line change @@ -2742,6 +2742,21 @@ void *x = uuid_create
2742
2742
[ AC_MSG_RESULT ( no ) ]
2743
2743
)
2744
2744
2745
+ # Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet
2746
+ # stream in big-endian byte-order
2747
+ AC_MSG_CHECKING ( for uuid_enc_be )
2748
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [ [ #include <uuid.h>] ] , [ [
2749
+ #ifndef uuid_enc_be
2750
+ uuid_t uuid;
2751
+ unsigned char buf[ sizeof(uuid)] ;
2752
+ uuid_enc_be(buf, &uuid);
2753
+ #endif
2754
+ ] ] ) ] ,
2755
+ [ AC_DEFINE ( HAVE_UUID_ENC_BE , 1 , Define if uuid_enc_be ( ) exists. )
2756
+ AC_MSG_RESULT ( yes ) ] ,
2757
+ [ AC_MSG_RESULT ( no ) ]
2758
+ )
2759
+
2745
2760
# 'Real Time' functions on Solaris
2746
2761
# posix4 on Solaris 2.6
2747
2762
# pthread (first!) on Linux
Original file line number Diff line number Diff line change 1212
1212
/* Define if uuid_create() exists. */
1213
1213
#undef HAVE_UUID_CREATE
1214
1214
1215
+ /* Define if uuid_enc_be() exists. */
1216
+ #undef HAVE_UUID_ENC_BE
1217
+
1215
1218
/* Define if uuid_generate_time_safe() exists. */
1216
1219
#undef HAVE_UUID_GENERATE_TIME_SAFE
1217
1220
You can’t perform that action at this time.
0 commit comments