chiark / gitweb /
bus-message: avoid -Wnull-pointer-arithmetic warning on new clang
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Jan 2018 05:23:09 +0000 (16:23 +1100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:50:11 +0000 (07:50 +0200)
We just need some pointer, so use alignment directly converted
to the right type.

src/libelogind/sd-bus/bus-message.c

index cd4baf26876eab9c802d5ded3f820e7023b17d2f..41466555803cd553d261ae6d94bedb52d5b945f4 100644 (file)
@@ -1320,7 +1320,9 @@ static void *message_extend_body(
                         m->n_body_parts <= 0 ||
                         m->body_end->sealed ||
                         (padding != ALIGN_TO(m->body_end->size, align) - m->body_end->size) ||
-                        (force_inline && m->body_end->size > MEMFD_MIN_SIZE); /* if this must be an inlined extension, let's create a new part if the previous part is large enough to be inlined */
+                        (force_inline && m->body_end->size > MEMFD_MIN_SIZE);
+                        /* If this must be an inlined extension, let's create a new part if
+                         * the previous part is large enough to be inlined. */
 
                 if (add_new_part) {
                         if (padding > 0) {
@@ -1367,7 +1369,7 @@ static void *message_extend_body(
                 }
         } else
                 /* Return something that is not NULL and is aligned */
-                p = (uint8_t *) NULL + align;
+                p = (uint8_t*) align;
 
         m->body_size = end_body;
         message_extend_containers(m, added);
@@ -4778,7 +4780,7 @@ _public_ int sd_bus_message_read_array(
         if (sz == 0)
                 /* Zero length array, let's return some aligned
                  * pointer that is not NULL */
-                p = (uint8_t*) NULL + align;
+                p = (uint8_t*) align;
         else {
                 r = message_peek_body(m, &m->rindex, align, sz, &p);
                 if (r < 0)