mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Refactor some network.c code to create cidr_set_masklen_internal().
Merge several copies of "copy an inet value and adjust the mask length" code to create a single, conveniently C-callable function. This function is exported for future use by inet SPGiST support, but it's good cleanup anyway since we had three slightly-different-for-no-good-reason copies. (Extracted from a larger patch, to separate new code from refactoring of old code) Emre Hasegeli
This commit is contained in:
@@ -28,10 +28,12 @@ typedef struct
|
||||
} inet_struct;
|
||||
|
||||
/*
|
||||
* We use these values for the "family" field.
|
||||
*
|
||||
* Referencing all of the non-AF_INET types to AF_INET lets us work on
|
||||
* machines which may not have the appropriate address family (like
|
||||
* inet6 addresses when AF_INET6 isn't present) but doesn't cause a
|
||||
* dump/reload requirement. Existing databases used AF_INET for the family
|
||||
* dump/reload requirement. Pre-7.4 databases used AF_INET for the family
|
||||
* type on disk.
|
||||
*/
|
||||
#define PGSQL_AF_INET (AF_INET + 0)
|
||||
@@ -117,6 +119,7 @@ typedef struct macaddr
|
||||
/*
|
||||
* Support functions in network.c
|
||||
*/
|
||||
extern inet *cidr_set_masklen_internal(const inet *src, int bits);
|
||||
extern int bitncmp(const unsigned char *l, const unsigned char *r, int n);
|
||||
extern int bitncommon(const unsigned char *l, const unsigned char *r, int n);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user