aboutsummaryrefslogtreecommitdiff
path: root/lib/netlink-socket.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-07-13 16:00:29 -0700
committerBen Pfaff <blp@nicira.com>2012-08-03 13:33:13 -0700
commitebc56baa41db060b8783051e67b6fcbc148ebd60 (patch)
tree6eccb5e9fe078abf361ed9bcc2d23f5a3ca79395 /lib/netlink-socket.c
parente9c048007b113fdf05ca3ccbfa25d01c24f1da43 (diff)
util: New macro CONST_CAST.
Casts are sometimes necessary. One common reason that they are necessary is for discarding a "const" qualifier. However, this can impede maintenance: if the type of the expression being cast changes, then the presence of the cast can hide a necessary change in the code that does the cast. Using CONST_CAST, instead of a bare cast, makes these changes visible. Inspired by my own work elsewhere: http://git.savannah.gnu.org/cgit/pspp.git/tree/src/libpspp/cast.h#n80 Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/netlink-socket.c')
-rw-r--r--lib/netlink-socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 3bdbbd73..49a8493e 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -683,7 +683,7 @@ nl_sock_transact(struct nl_sock *sock, const struct ofpbuf *request,
struct nl_transaction *transactionp;
struct nl_transaction transaction;
- transaction.request = (struct ofpbuf *) request;
+ transaction.request = CONST_CAST(struct ofpbuf *, request);
transaction.reply = replyp ? ofpbuf_new(1024) : NULL;
transactionp = &transaction;