× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Mon, May 23, 2016 at 12:31 PM, Bradley Stone <bvstone@xxxxxxxxx> wrote:
My main thing is I want to stay away from any limits and RPG variables. I
just want a pointer and the length.

Hm. Serves me right for jumping in when I did without really following
the earlier discussion you had with Scott (and Barbara).

From the discussion we had earlier, it seems like we have the pointer
available and using the C API to get the length (which I guess finds the
null) we get the length.

That's my understanding as well.

But I totally misinterpreted the term "buffer", because I didn't
reference the earlier material. Here's the relevant stuff for folks
who were either careless like me, or have short attention spans:

From: http://archive.midrange.com/rpg400-l/201604/msg00144.html

[Scott said:]
If you want the data to be translated to EBCDIC, that is more
complicated because the length of the data can vary so much, you don't
necessarily know up front how big the data will be. You could
dynamically allocate the memory, but then the caller would have to
fuss with making sure it's freed up, which I prefer to avoid.

So what I would do is let the caller provide the buffer. Instead of
returning a pointer, just put data into the caller's buffer. Then if
it wants to use dynamic allocation, it can... but it could also just
use a large(-er) variable or user space or whatever makes sense.
[End quote]

So when Scott talks about a buffer, he totally means the buffer
provided by the caller. In RPG. I had completely misinterpreted
everything, and thought you were both dealing directly in C. Sorry.

OK, now that I've looked at your respective YAJL_GET_STRING_BUF()
procedures (in RPG), it sounds like Scott is saying that your (Brad's)
way forces the caller of YAJL_GET_STRING_BUF() to do the cleanup of
dynamically-allocated memory. Which I guess is what you (Brad) had
expected and wanted to do anyway; but Scott seems to prefer
YAJL_GET_STRING_BUF() not impose that requirement. Instead, his
(Scott's) way imposes a different requirement, which is that the
caller must pre-declare the maximum size of the data to be returned.

And that is, unfortunately, exactly what you (Brad) are trying to
avoid. So it seems you're at an impasse. I would think at this point
the most proper thing to do is have a dynamic version and a static
version (with different names) and include both in the YAJL package
(if Scott's willing).

Or maybe I have still misread things. (A very good possibility!)

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.