ofp-print: ofp_packet_to_string() Do not emit extra trailing newline
authorSimon Horman <horms@verge.net.au>
Fri, 17 May 2013 05:14:13 +0000 (14:14 +0900)
committerBen Pfaff <blp@nicira.com>
Fri, 17 May 2013 05:49:21 +0000 (22:49 -0700)
commit4b2d9d113f8eb7ee4e6bf703e81d4169377fc26b
tree716fd263499069e561c3570eac05ac120662639f
parent2291eb080c1afe13a5d3cb3048f0d160386b714b
ofp-print: ofp_packet_to_string() Do not emit extra trailing newline

The string produced by ofp_packet_to_string() includes a trailing
newline, so in the case where packet data is formatted by
ofp_print_packet_out() there is already a newline present.

This patch updates ofp_print_packet_out() so that it does not
add a second newline in this case.

It is not necessary to update the case where there is packet data
to ensure that the result it is terminated by a "\n" as the higher-level
ofp_to_string() function will ensure that the result is "\n" terminated.

The test-suite has be updated to exercise output of packet data by
ofp_packet_to_string()

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-print.c
tests/ofp-print.at