MAJOR: sample: converts uint and sint in 64 bits signed integer

This patch removes the 32 bits unsigned integer and the 32 bit signed
integer. It replaces these types by a unique type 64 bit signed.

This makes easy the usage of integer and clarify signed and unsigned use.
With the previous version, signed and unsigned are used ones in place of
others, and sometimes the converter loose the sign. For example, divisions
are processed with "unsigned", if one entry is negative, the result is
wrong.

Note that the integer pattern matching and dotted version pattern matching
are already working with signed 64 bits integer values.

There is one user-visible change : the "uint()" and "sint()" sample fetch
functions which used to return a constant integer have been replaced with
a new more natural, unified "int()" function. These functions were only
introduced in the latest 1.6-dev2 so there's no impact on regular
deployments.
This commit is contained in:
Thierry FOURNIER
2015-07-06 23:43:03 +02:00
committed by Willy Tarreau
parent 5b4dd683cb
commit 07ee64ef4d
18 changed files with 584 additions and 644 deletions

View File

@@ -36,8 +36,7 @@ struct arg;
enum {
SMP_T_ANY = 0, /* any type */
SMP_T_BOOL, /* boolean */
SMP_T_UINT, /* unsigned 32bits integer type */
SMP_T_SINT, /* signed 32bits integer type */
SMP_T_SINT, /* signed 64bits integer type */
SMP_T_ADDR, /* ipv4 or ipv6, only used for input type compatibility */
SMP_T_IPV4, /* ipv4 type */
SMP_T_IPV6, /* ipv6 type */
@@ -237,8 +236,7 @@ struct sample {
unsigned int flags; /* SMP_F_* */
int type; /* SMP_T_* */
union {
unsigned int uint; /* used for unsigned 32bits integers and booleans */
int sint; /* used for signed 32bits integers */
long long int sint; /* used for signed 64bits integers */
struct in_addr ipv4; /* used for ipv4 addresses */
struct in6_addr ipv6; /* used for ipv6 addresses */
struct chunk str; /* used for char strings or buffers */
@@ -261,8 +259,7 @@ struct sample {
struct sample_storage {
int type; /* SMP_T_* */
union {
unsigned int uint; /* used for unsigned 32bits integers and booleans */
int sint; /* used for signed 32bits integers */
long long int sint; /* used for signed 64bits integers */
struct in_addr ipv4; /* used for ipv4 addresses */
struct in6_addr ipv6; /* used for ipv6 addresses */
struct chunk str; /* used for char strings or buffers */