[ 
https://issues.apache.org/jira/browse/DISPATCH-1403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17461627#comment-17461627
 ] 

ASF GitHub Bot commented on DISPATCH-1403:
------------------------------------------

ganeshmurthy commented on a change in pull request #1465:
URL: https://github.com/apache/qpid-dispatch/pull/1465#discussion_r771649114



##########
File path: include/qpid/dispatch/buffer_field.h
##########
@@ -0,0 +1,44 @@
+#ifndef __dispatch_buffer_field_h__
+#define __dispatch_buffer_field_h__ 1
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/** @file
+ * Data fields spanning multiple buffers
+ * @internal
+ * @defgroup buffer_field buffer_field
+ * @{
+ */
+
+#include "qpid/dispatch/buffer.h"
+
+#include <stdbool.h>
+
+/* descriptor for a sequence of bytes in a buffer list
+ */
+typedef struct qd_buffer_field_t qd_buffer_field_t;
+struct qd_buffer_field_t {
+    qd_buffer_t   *buffer;  // hold start of data
+    const uint8_t *cursor;  // first octet of data
+    size_t         length;  // of data

Review comment:
       Should length be called remaining_length ? The reason I ask is that the 
length field continue to decrease as we move thru the buffer and *length* 
sounds like something that does not change. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Consolidate chained qd_buffer_t field handling code
> ---------------------------------------------------
>
>                 Key: DISPATCH-1403
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-1403
>             Project: Qpid Dispatch
>          Issue Type: Improvement
>          Components: Router Node
>    Affects Versions: 1.8.0, 1.9.0
>            Reporter: Ken Giusti
>            Assignee: Ken Giusti
>            Priority: Minor
>              Labels: refactor
>             Fix For: Backlog
>
>
> There are many places in the router's C codebase where we need to work with 
> data spanning a chained qd_buffer_t list.   In particular the low level 
> operations such as:
> * advance N bytes
> * compare N bytes
> * copy N bytes
> are common throughout the code.
> Here are examples from the iterator.c library:
> [copy 
> bytes|https://github.com/apache/qpid-dispatch/blob/master/src/iterator.c#L378]
> [advance 
> cursor|https://github.com/apache/qpid-dispatch/blob/master/src/iterator.c#L424]
> [compare|https://github.com/apache/qpid-dispatch/blob/master/src/iterator.c#L467]
> Similar logic is implemented in message.c and parse.c.
> We should de-duplicate this code by providing a common implementation as part 
> of the buffer handling code.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to