qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alanconway <...@git.apache.org>
Subject [GitHub] qpid-proton pull request: NO-JIRA: Measure size of encoded data.
Date Tue, 10 Mar 2015 18:12:35 GMT
GitHub user alanconway opened a pull request:

    https://github.com/apache/qpid-proton/pull/11

    NO-JIRA: Measure size of encoded data.

    Introduce pn_data_encode2 which allows you to both encode data and, if you don't have
enough
    space, find out how much space you need. You can also use this to simply find out how
    much space is required to  the data.
    
    This supports two patterns of use:
    
    1. Check how much space you need, allocate the space and encode.
    
    2. Try to encode into a buffer you already have. If that doesn't work, re-allocate
       to the correct size and encode.
    
    Eliminates the need for guessing and buffer doubling strategies, which are
    inefficient given that we know exactly what is in the data.
    
    The original pn_data_encode is unmodified for compatibility.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alanconway/qpid-proton encode-size

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-proton/pull/11.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11
    
----
commit f117ef5dee718ee6ea6af49e32750eecd81a1d12
Author: Alan Conway <aconway@redhat.com>
Date:   2015-03-10T16:16:32Z

    NO-JIRA: Measure size of encoded data.
    
    Introduce pn_data_encode2 which allows you to both encode data and, if you don't have
enough
    space, find out how much space you need. You can also use this to simply find out how
    much space is required to  the data.
    
    This supports two patterns of use:
    
    1. Check how much space you need, allocate the space and encode.
    
    2. Try to encode into a buffer you already have. If that doesn't work, re-allocate
       to the correct size and encode.
    
    Eliminates the need for guessing and buffer doubling strategies, which are
    inefficient given that we know exactly what is in the data.
    
    The original pn_data_encode is unmodified for compatibility.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message