Re: [E] Re: Proposed change to TS API: TSHeapBuf

2023-01-04 Thread Walt Karas
I'll wait a couple more days for input, then I'll change it to return char * and take an int * parameter to output the length. If we're switching to C++, we can update this based on whatever consensus we reach for the switchover strategy. On Wed, Jan 4, 2023 at 7:03 PM Masakazu Kitajo wrote: >

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2023-01-04 Thread Masakazu Kitajo
> They could make the returned structure a nesting structure in their structure. What if the structure is defined by a library and a plugin author can't modify it? What I'm trying to say is that I don't see the benefit of limiting how a user receives the pointer and the length where nothing receiv

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2023-01-04 Thread Walt Karas
There are people at Yahoo who have written plugins in straight C, and don't want to change to C++. On Wed, Jan 4, 2023 at 1:10 PM Leif Hedstrom wrote: > This looks like a string_view to me? > > Why don’t we do what we talked about for years now, and stop supporting > compiling plug-ins with C bu

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2023-01-04 Thread Leif Hedstrom
This looks like a string_view to me? Why don’t we do what we talked about for years now, and stop supporting compiling plug-ins with C but require C++? Then we can introduce nice things in ts.h. The old C plugins just have to be changed to compile with C++, and ABI compatibility within major v

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2023-01-04 Thread Walt Karas
They could make the returned structure a nesting structure in their structure. Better to make things more convenient for the typical case, not the unusual case. On Tue, Jan 3, 2023 at 12:28 PM Masakazu Kitajo wrote: > What's the benefit of forcing users to use the structure? A user might want >

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2023-01-03 Thread Masakazu Kitajo
What's the benefit of forcing users to use the structure? A user might want to store the returned pointer into a user-defined structure. On Tue, Sep 6, 2022 at 10:24 AM Walt Karas wrote: > Presumably we don't need to allow for use of antiquated C compilers that > don't allow structures as retu

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2022-09-06 Thread Walt Karas
Presumably we don't need to allow for use of antiquated C compilers that don't allow structures as return values. So this: typedef struct { char *data; int length; } TSVarLenData; TSVarLenData TSSomething(x, y, z); Is another alternative. On Thu, Sep 1, 2022 at 5:32 PM Masakazu Kitajo wrote:

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2022-09-01 Thread Masakazu Kitajo
Using encapsulation/data abstraction is fine, but it doesn't seem like TSHeapBuf makes sense. No TS API receives it. If plugin code is the only user and it has to deal with a non-const raw pointer and a data length after all, why do we want to wrap them in the first place? As for smaller steps, li

Re: [E] Re: Proposed change to TS API: TSHeapBuf

2022-08-31 Thread Walt Karas
As a rule of thumb, I prefer using encapsulation/data abstraction. I think perhaps that is one reason I've been a poor match to this project. There doesn't seem to be a consensus that we should follow this rule of thumb. KIt, that would be my preference. But I am part of the consensus I think

Re: Proposed change to TS API: TSHeapBuf

2022-08-31 Thread Shu Kit Chan
Also are we planning to eventually rewrite our existing APIs (where applicable) to use this? On Wed, Aug 31, 2022 at 8:36 AM Masakazu Kitajo wrote: > > What's the advantage of using TSHeapBuf? What issue does it solve? > > > On Wed, Aug 31, 2022 at 7:48 AM Walt Karas > wrote: > > > Described her

Re: Proposed change to TS API: TSHeapBuf

2022-08-31 Thread Masakazu Kitajo
What's the advantage of using TSHeapBuf? What issue does it solve? On Wed, Aug 31, 2022 at 7:48 AM Walt Karas wrote: > Described here: > > https://github.com/apache/trafficserver/blob/os_pkey_cnf_reload/doc/developer-guide/api/functions/TSHeapBuf.en.rst#tsheapbufdata > , > > In PR https://githu