diff mbox

[3/5] validation: cosmetic changes in odp_packet.c

Message ID 1435316981-22355-4-git-send-email-christophe.milard@linaro.org
State New
Headers show

Commit Message

Christophe Milard June 26, 2015, 11:09 a.m. UTC
To please check-patch as much as possible before the
file gets moved (and rechecked by check-odp)
Note that CU_ASSERT (xxx != NULL) cannot be written CU_ASSERT(xxx),
as CU_ASSERT expects an int as parameter.
Casting would sureley work, but really is  CU_ASSERT((int)(x)) clearer than
CU_ASSERT (x != NULL) ?
Also, braces are required in if/then/else with CU_ASSERT macro.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/validation/odp_packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stuart Haslam June 29, 2015, 10:25 a.m. UTC | #1
On Fri, Jun 26, 2015 at 01:09:39PM +0200, Christophe Milard wrote:
> To please check-patch as much as possible before the
> file gets moved (and rechecked by check-odp)
> Note that CU_ASSERT (xxx != NULL) cannot be written CU_ASSERT(xxx),
> as CU_ASSERT expects an int as parameter.
> Casting would sureley work, but really is  CU_ASSERT((int)(x)) clearer than
> CU_ASSERT (x != NULL) ?

What about CU_ASSERT_PTR_NOT_NULL(x)?
Christophe Milard June 29, 2015, 11:56 a.m. UTC | #2
On 29 June 2015 at 12:25, Stuart Haslam <stuart.haslam@linaro.org> wrote:

> On Fri, Jun 26, 2015 at 01:09:39PM +0200, Christophe Milard wrote:
> > To please check-patch as much as possible before the
> > file gets moved (and rechecked by check-odp)
> > Note that CU_ASSERT (xxx != NULL) cannot be written CU_ASSERT(xxx),
> > as CU_ASSERT expects an int as parameter.
> > Casting would sureley work, but really is  CU_ASSERT((int)(x)) clearer
> than
> > CU_ASSERT (x != NULL) ?
>
> What about CU_ASSERT_PTR_NOT_NULL(x)?
>

Argh! of course... fixed in V2


>
> --
> Stuart.
>
diff mbox

Patch

diff --git a/test/validation/odp_packet.c b/test/validation/odp_packet.c
index e9a022c..9150a16 100644
--- a/test/validation/odp_packet.c
+++ b/test/validation/odp_packet.c
@@ -145,6 +145,7 @@  static void packet_test_event_conversion(void)
 static void packet_test_basic_metadata(void)
 {
 	odp_packet_t pkt = test_packet;
+
 	CU_ASSERT(odp_packet_head(pkt) != NULL);
 	CU_ASSERT(odp_packet_data(pkt) != NULL);
 
@@ -317,6 +318,7 @@  static void _verify_tailroom_shift(odp_packet_t pkt,
 
 	if (shift >= 0) {
 		uint32_t l2_off, l3_off, l4_off;
+
 		l2_off = odp_packet_l2_offset(pkt);
 		l3_off = odp_packet_l3_offset(pkt);
 		l4_off = odp_packet_l4_offset(pkt);
@@ -390,7 +392,6 @@  static void packet_test_segments(void)
 		CU_ASSERT(num_segs == 1);
 	}
 
-
 	seg = odp_packet_first_seg(pkt);
 	buf_len = 0;
 	data_len = 0;
@@ -556,7 +557,6 @@  free_packet:
 	odp_packet_free(pkt);
 }
 
-
 #define COMPARE_INFLAG(p1, p2, flag) \
 	CU_ASSERT(odp_packet_has_##flag(p1) == odp_packet_has_##flag(p2))