You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (JIRA)" <ji...@apache.org> on 2010/12/03 06:34:11 UTC

[jira] Created: (TS-579) Eliminate string copies in the SDK

Eliminate string copies in the SDK 
-----------------------------------

                 Key: TS-579
                 URL: https://issues.apache.org/jira/browse/TS-579
             Project: Traffic Server
          Issue Type: Bug
          Components: TSAPI
            Reporter: Leif Hedstrom
             Fix For: 2.1.5
         Attachments: TS-579.diff

There are a small'ish number of APIs, that (for legacy reasons I believe) makes copies of the marshalled header strings, just to make them NULL terminated. None of these APIs claim to guarantee the strings to be NULL terminated, and all of our APIs pretty much says that you should never expect strings to be NULL terminated.

Eliminating this string duplication will make the APIs easier to use (since now TSHandleStringRelease() is completely unecessary), and will also make plugins faster (no mallocs and frees for these strings).

The APIs that are affected, only by contract (no API changes) are

const char * TSUrlSchemeGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlUserGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlPasswordGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHostGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlPathGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc obj, int *length);

const char *TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int *length);
const char *TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc obj, int *length);

TSReturnCode TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char **value_ptr, int *value_len_ptr);



>From now on, these will never be NULL terminated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TS-579) Eliminate string copies in the SDK

Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TS-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Hedstrom resolved TS-579.
------------------------------

    Resolution: Fixed

> Eliminate string copies in the SDK 
> -----------------------------------
>
>                 Key: TS-579
>                 URL: https://issues.apache.org/jira/browse/TS-579
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: TSAPI
>            Reporter: Leif Hedstrom
>            Assignee: Leif Hedstrom
>             Fix For: 2.1.5
>
>         Attachments: TS-579.diff
>
>
> There are a small'ish number of APIs, that (for legacy reasons I believe) makes copies of the marshalled header strings, just to make them NULL terminated. None of these APIs claim to guarantee the strings to be NULL terminated, and all of our APIs pretty much says that you should never expect strings to be NULL terminated.
> Eliminating this string duplication will make the APIs easier to use (since now TSHandleStringRelease() is completely unecessary), and will also make plugins faster (no mallocs and frees for these strings).
> The APIs that are affected, only by contract (no API changes) are
> const char * TSUrlSchemeGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlUserGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlPasswordGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHostGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlPathGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int *length);
> const char *TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc obj, int *length);
> TSReturnCode TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char **value_ptr, int *value_len_ptr);
> From now on, these will never be NULL terminated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TS-579) Eliminate string copies in the SDK

Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TS-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Hedstrom updated TS-579:
-----------------------------

    Attachment: TS-579.diff

Proposed changes to eliminate unecessary string copies (and releases) in the SDK APIs

> Eliminate string copies in the SDK 
> -----------------------------------
>
>                 Key: TS-579
>                 URL: https://issues.apache.org/jira/browse/TS-579
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: TSAPI
>            Reporter: Leif Hedstrom
>            Assignee: Leif Hedstrom
>             Fix For: 2.1.5
>
>         Attachments: TS-579.diff
>
>
> There are a small'ish number of APIs, that (for legacy reasons I believe) makes copies of the marshalled header strings, just to make them NULL terminated. None of these APIs claim to guarantee the strings to be NULL terminated, and all of our APIs pretty much says that you should never expect strings to be NULL terminated.
> Eliminating this string duplication will make the APIs easier to use (since now TSHandleStringRelease() is completely unecessary), and will also make plugins faster (no mallocs and frees for these strings).
> The APIs that are affected, only by contract (no API changes) are
> const char * TSUrlSchemeGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlUserGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlPasswordGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHostGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlPathGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int *length);
> const char *TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc obj, int *length);
> TSReturnCode TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char **value_ptr, int *value_len_ptr);
> From now on, these will never be NULL terminated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (TS-579) Eliminate string copies in the SDK

Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TS-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Hedstrom reassigned TS-579:
--------------------------------

    Assignee: Leif Hedstrom

> Eliminate string copies in the SDK 
> -----------------------------------
>
>                 Key: TS-579
>                 URL: https://issues.apache.org/jira/browse/TS-579
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: TSAPI
>            Reporter: Leif Hedstrom
>            Assignee: Leif Hedstrom
>             Fix For: 2.1.5
>
>         Attachments: TS-579.diff
>
>
> There are a small'ish number of APIs, that (for legacy reasons I believe) makes copies of the marshalled header strings, just to make them NULL terminated. None of these APIs claim to guarantee the strings to be NULL terminated, and all of our APIs pretty much says that you should never expect strings to be NULL terminated.
> Eliminating this string duplication will make the APIs easier to use (since now TSHandleStringRelease() is completely unecessary), and will also make plugins faster (no mallocs and frees for these strings).
> The APIs that are affected, only by contract (no API changes) are
> const char * TSUrlSchemeGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlUserGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlPasswordGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHostGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlPathGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int *length);
> const char *TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc obj, int *length);
> const char *TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc obj, int *length);
> TSReturnCode TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int idx, const char **value_ptr, int *value_len_ptr);
> From now on, these will never be NULL terminated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.