axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
char * axl_stream_get_until_ref ( axlStream stream,
char *  valid_chars,
int *  chunk_matched,
axl_bool  accept_terminator,
int *  result_size,
int  chunk_num,
  ... 
)

Works the same way like axl_strteam_get_until but wihtout allocating the memory returned, and filling the size for the chunk returned in result_size reference.

Parameters
streamThe stream where the operation will be performed.
valid_charsThe valid chars reference to match (currently not implemented).
chunk_matchedThe chunk matched reference
accept_terminatorConfigure if the terminator should be accepted or not.
result_sizeThe variable where the result size will be returned. This variable is not optional. It must be configured to hold the size of the content returned. If you provided a NULL reference to this value then the function will fail.
chunk_numThe number of chunks to match.
Returns
A reference to the internal stream copy. The reference returned must not be deallocated.

NOTE: This function have a particular function that could produce not desired results. Because the stream returns a reference to the current allocated stream, if nullifies the last position (\0) to avoid memory problems with printf APIs and any other code that relay on the fact that C strings are NULL terminated. If the content immediately following to the string returned is meaningful, then you can't use this function. Example:

1 stream: CONTENTCONTENT2
2  ^
3  |
4  +--- stream index
5 
6 calling to axl_stream_get_until_ref (stream, NULL, NULL, axl_false,
7  &size, 1, "CONTENT");
8 
9 while cause stream: CONTENT\0ONTENT2
10  ^
11  |
12  +--- stream index
13 
14 and the function returning "CONTENT". See the fact that the
15 next "C" from the word CONTENT2 is nullified.

An indication that this function is not what you want is that you are not accepting the terminator (accept_terminator=axl_false).

References axl_return_val_if_fail, and axl_stream_get_untilv().