]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: connection: replace struct target with a pointer to an enum
authorWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 23:42:33 +0000 (00:42 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 23:42:33 +0000 (00:42 +0100)
commit3fdb3668852c7b39a93fa960515ad89d8229332b
tree7ab3ccd1528118b853cca59c258a424f560d5716
parent128b03c9ab55a5d7b43497bf859d62e6c423285f
MAJOR: connection: replace struct target with a pointer to an enum

Instead of storing a couple of (int, ptr) in the struct connection
and the struct session, we use a different method : we only store a
pointer to an integer which is stored inside the target object and
which contains a unique type identifier. That way, the pointer allows
us to retrieve the object type (by dereferencing it) and the object's
address (by computing the displacement in the target structure). The
NULL pointer always corresponds to OBJ_TYPE_NONE.

This reduces the size of the connection and session structs. It also
simplifies target assignment and compare.

In order to improve the generated code, we try to put the obj_type
element at the beginning of all the structs (listener, server, proxy,
si_applet), so that the original and target pointers are always equal.

A lot of code was touched by massive replaces, but the changes are not
that important.
22 files changed:
include/proto/connection.h
include/proto/obj_type.h [new file with mode: 0644]
include/types/connection.h
include/types/listener.h
include/types/obj_type.h [new file with mode: 0644]
include/types/proxy.h
include/types/server.h
include/types/session.h
include/types/stream_interface.h
src/backend.c
src/cfgparse.c
src/checks.c
src/dumpstats.c
src/log.c
src/peers.c
src/proto_http.c
src/proto_tcp.c
src/proxy.c
src/queue.c
src/session.c
src/ssl_sock.c
src/stream_interface.c