File tree Expand file tree Collapse file tree
postgresql/protocol/optimized Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ parse_tuple_message(PyObject *self, PyObject *args)
5858 "invalid tuple message: %d bytes is too small" , dlen );
5959 return (NULL );
6060 }
61- natts = ntohs (* ((uint16_t * ) (data )));
61+ natts = local_ntohs (* ((uint16_t * ) (data )));
6262
6363 /*
6464 * FEARME: A bit much for saving a reallocation/copy?
@@ -91,7 +91,7 @@ parse_tuple_message(PyObject *self, PyObject *args)
9191 goto cleanup ;
9292 }
9393
94- attsize = ntohl (* ((uint32_t * ) (data + position )));
94+ attsize = local_ntohl (* ((uint32_t * ) (data + position )));
9595 position += 4 ;
9696 /*
9797 * NULL.
Original file line number Diff line number Diff line change 2121 */
2222static PyObject * message_types = NULL ;
2323static long (* local_ntohl )(long ) = NULL ;
24+ static short (* local_ntohs )(short ) = NULL ;
2425
2526
2627#include "typio.c"
@@ -74,11 +75,13 @@ PyInit_optimized(void)
7475 {
7576 /* little */
7677 local_ntohl = swap_long ;
78+ local_ntohs = swap_short ;
7779 }
7880 else
7981 {
8082 /* big */
8183 local_ntohl = return_long ;
84+ local_ntohs = return_short ;
8285 }
8386
8487 /*
Original file line number Diff line number Diff line change 3535 c=P[4];P[4]=P[3];P[3]=c;\
3636}while(0)
3737
38+ static short
39+ swap_short (short s )
40+ {
41+ swap2 (((char * ) & s ));
42+ return (s );
43+ }
44+
45+ static short
46+ return_short (short s )
47+ {
48+ return (s );
49+ }
50+
3851static long
3952swap_long (long l )
4053{
You can’t perform that action at this time.
0 commit comments