diff mbox

[ovs-dev,4/4] ofpbuf: Use ptrdiff_t for pointer delta.

Message ID 1456993371-9902-4-git-send-email-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer March 3, 2016, 8:22 a.m. UTC
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 lib/ofpbuf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Jarno Rajahalme March 3, 2016, 9:27 p.m. UTC | #1
For the series:

Acked-by: Jarno Rajahalme <jarno@ovn.org>

While looking at lib/ofpbuf.c, I noticed a bug for which I’ll send a separate patch.

  Jarno

> On Mar 3, 2016, at 12:22 AM, Joe Stringer <joe@ovn.org> wrote:
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
> lib/ofpbuf.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
> index a3c4da4bcbbe..02c9d15f82bf 100644
> --- a/lib/ofpbuf.c
> +++ b/lib/ofpbuf.c
> @@ -183,8 +183,7 @@ ofpbuf_clone_with_headroom(const struct ofpbuf *buffer, size_t headroom)
>                                                  buffer->size,
>                                                  headroom);
>     if (buffer->header) {
> -        uintptr_t data_delta
> -            = (char *)new_buffer->data - (char *)buffer->data;
> +        ptrdiff_t data_delta = (char *)new_buffer->data - (char *)buffer->data;
> 
>         new_buffer->header = (char *) buffer->header + data_delta;
>     }
> @@ -267,12 +266,12 @@ ofpbuf_resize__(struct ofpbuf *b, size_t new_headroom, size_t new_tailroom)
>     new_data = (char *) new_base + new_headroom;
>     if (b->data != new_data) {
>         if (b->header) {
> -            uintptr_t data_delta = (char *) b->header - (char *) b->data;
> +            ptrdiff_t data_delta = (char *) b->header - (char *) b->data;
> 
>             b->header = (char *) new_data + data_delta;
>         }
>         if (b->msg) {
> -            uintptr_t data_delta = (char *) b->msg - (char *) b->data;
> +            ptrdiff_t data_delta = (char *) b->msg - (char *) b->data;
> 
>             b->msg = (char *) new_data + data_delta;
>         }
> -- 
> 2.1.4
>
Joe Stringer March 3, 2016, 10:29 p.m. UTC | #2
On 3 March 2016 at 13:27, Jarno Rajahalme <jarno@ovn.org> wrote:
> For the series:
>
> Acked-by: Jarno Rajahalme <jarno@ovn.org>
>
> While looking at lib/ofpbuf.c, I noticed a bug for which I’ll send a separate patch.
>
>   Jarno

Thanks, I applied the series to master.
diff mbox

Patch

diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index a3c4da4bcbbe..02c9d15f82bf 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -183,8 +183,7 @@  ofpbuf_clone_with_headroom(const struct ofpbuf *buffer, size_t headroom)
                                                  buffer->size,
                                                  headroom);
     if (buffer->header) {
-        uintptr_t data_delta
-            = (char *)new_buffer->data - (char *)buffer->data;
+        ptrdiff_t data_delta = (char *)new_buffer->data - (char *)buffer->data;
 
         new_buffer->header = (char *) buffer->header + data_delta;
     }
@@ -267,12 +266,12 @@  ofpbuf_resize__(struct ofpbuf *b, size_t new_headroom, size_t new_tailroom)
     new_data = (char *) new_base + new_headroom;
     if (b->data != new_data) {
         if (b->header) {
-            uintptr_t data_delta = (char *) b->header - (char *) b->data;
+            ptrdiff_t data_delta = (char *) b->header - (char *) b->data;
 
             b->header = (char *) new_data + data_delta;
         }
         if (b->msg) {
-            uintptr_t data_delta = (char *) b->msg - (char *) b->data;
+            ptrdiff_t data_delta = (char *) b->msg - (char *) b->data;
 
             b->msg = (char *) new_data + data_delta;
         }