|
SYNOPSIS#include <vstr.h>
DESCRIPTIONA very simple overview is that you call vstr_init() at the start of your program and vstr_exit() at the end. You can make new Vstr strings by calling vstr_make_base(), and free them by calling vstr_free_base(). There are also a vstr_dup_* set of functions to make a new Vstr string with data in them. You can then add/delete data from this string, using the provided functions, if you need to use all or part of the string with a "C string" interface then you can call vstr_export_cstr_ptr() or vstr_export_cstr_malloc().Library initialization and exit functionsFunction: vstr_init() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Nothing
Explanation: This function needs to be called before any of the other functions are called. Note: The function can be called multiple times, without any problems.
Parameter[1]: Nothing
Explanation: This function can be called before exit, after all vstr objects have been freed, to cleanup data allocated internally in the Vstr library. Note: The function isn't needed but helps make sure there are no memory leaks, when used with a memory checker (or with the internal memory checker in the debug build). Exporting data functionsFunction: vstr_export_cstr_ptr() Returns: A pointer to an array of characters, terminated by NIL Type: const char * Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Explanation: This function is used to export a pointer to an array of characters of length (Parameter[3] + 1), the last byte will be a 0 to terminate the "C string". Multiple adjacent calls will return the same pointer. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return NULL if it needs to allocate memory and cannot do so. Note: If you alter the Vstr in anyway then the returned pointer may point to free()'d memory. To get a reference to this data use vstr_export_cstr_ref() instead. This data needs to be cached in the Vstr string, and so can only work if the Vstr string has the ability to cache data (see VSTR_CNTL_BASE_GET_FLAG_HAVE_CACHE). If you want to make sure that the cached data is gone from the Vstr string, cache then you can call vstr_cache_cb_free() on the cookie from "/vstr__/cstr". Any _NON data in the Vstr will be uninitialized data in the "C string". If there are any 0 bytes in the Vstr they will make the string look shorter than it really is to normal C style string functions.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Explanation: This function is used to export a malloc'd pointer to an array of characters of length (Parameter[3] + 1), the last byte will be a 0 to terminate the "C string". You will need to pass the pointer to free(), when you are done with it. Each call will return a different pointer. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return NULL if it needs to allocate memory and cannot do so. Note: Any _NON data in the Vstr will be uninitialized data in the "C string". If there are any 0 bytes in the Vstr they will make the string look shorter than it really is to normal C/POSIX string functions.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Parameter[4]: Data array to export to
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to export a copy of the data in the Vstr string to a data array, the maximum amount of data stored in the array will be of length (Parameter[3] + 1), the last byte will be a 0 to terminate the "C string". However the data before the terminator of the "C string" is limited to (Parameter[5] - 1). Note: Data from nodes of type NON are exported by not doing anything to the underlying data array (Ie. It'll have whatever data was in there to start with). If there are any 0 bytes in the Vstr they will make the "C string" look shorter than it really is to normal C/POSIX string functions.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Parameter[4]: Offset of Vstr memory reference (Return)
Explanation: This function is used to return a pointer to a Vstr memory reference of at least length (Parameter[3] + 1), the last byte will be a 0 to terminate the "C string" stored in (Vstr_ref *)->ptr. The offset (Parameter[4]) should be used to find the beginning of the block of memory to use. When you are finished with the reference you need to use vstr_ref_del() or the memory will stay allocated forever. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return NULL if it needs to allocate memory and cannot do so. Note: If you want to make sure that the cached data is gone from the Vstr string, cache then you can call vstr_cache_cb_free() on the cookie from "/vstr__/cstr". Any _NON data in the Vstr will be uninitialized data in the "C string". If there are any 0 bytes in the Vstr they will make the string look shorter than it really is to normal C/POSIX string functions.
Parameter[1]: Vstr string
Parameter[2]: Returns the start of the iovec array
Parameter[2]: Returns the number of iovec structures in the
array
Explanation: This function is used to export a pointer to an array of iovec structures this can then be passed directly to writev() etc. or just used to quickly access the data in the Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so. Note: Nodes of type NON are represented by a iov_base set to NULL. Altering the iov_base/iov_len members will probably do very bad things, if you need to do this use the vstr_export_iovec_cpy_ptr() Altering the data in the iovec structure isn't a good idea as it isn't easy for the programer to know if the data is shared/read-only. If you need to do this you should use either the vstr_sub_* functions instead or vstr_export_iovec_cpy_buf() (the later does a copy). However if you do alter the data then you'll need to do vstr_cache_cb_sub(). Either of the pointers for the iovec array (Parameter[2]) or the number of iovecs (Parameter[3]) can be the NULL pointer, in which case nothing will be written to those pointers.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to array of initialized iovec
structures
Parameter[5]: Number of iovec structures (Parameter[4])
Parameter[6]: Returns the number of iovec structures used
in the array
Explanation: This function is used to export a copy of the data in the Vstr string to an array of iovec structures this can then be passed directly to writev() (or even a readv() although that wouldn't often be useful) etc. Think of this function as doing a readv() from a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: Data from nodes of type NON are exported by not doing anything to the underlying iov_base data arrays (Ie. It'll have whatever data was in there to start with). The length returned may be shorter than that given as Parameter[3], as it's the number of bytes copied into the iov_base arrays in the iovec structures.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to array of iovec structures
Parameter[5]: Number of iovec structures (Parameter[4])
Parameter[6]: Returns the number of iovec structures used
in the array
Explanation: This function is used to export a set of pointer/length pairs to the data specified in the Vstr string, this can then be passed directly to writev() etc. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: Nodes of type NON are represented by a iov_base set to NULL. Altering the data in the iovec structure isn't a good idea as it isn't easy for the programer to know if the data is shared/read-only. If you need to do this you should use either the vstr_sub_* functions instead or vstr_export_iovec_cpy_buf() (the later does a copy).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Data array to export to
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to export a copy of the data in the Vstr string to a data array. Think of this function as doing a read() from a Vstr string. However the data will be limited to the minimum of the length of the vstr (Parameter[3]) and the length of the data (Parameter[5]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: Data from nodes of type NON are exported by not doing anything to the underlying data array (Ie. It'll have whatever data was in there to start with).
Parameter[1]: Vstr string
Parameter[2]: Position in the Vstr string (Parameter[1])
Explanation: This function is used to return a character at a certain position in a Vstr string. Note: It is impossible to distinguish between an error, data from a NON node and real data that is equal to the value 0.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Parameter[4]: Offset of Vstr memory reference (Return)
Explanation: This function is used to return a pointer to a Vstr memory reference of at least length (Parameter[3]). The offset (Parameter[4]) should be used to find the beginning of the block of memory to use. When you are finished with the reference you need to use vstr_ref_del() or the memory will stay allocated forever. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return NULL if it needs to allocate memory and cannot do so. Note: Any _NON data in the Vstr will be uninitialized data in the memory pointed to by the memory reference. Memory reference functionsFunction: vstr_ref_add() Returns: Vstr memory reference (Parameter[1]) Type: struct Vstr_ref * Parameter[1]: Vstr memory reference
Explanation: This function will add a reference count to the Vstr_ref (Parameter[1]).
Parameter[1]: Vstr memory reference
Explanation: This function will delete a reference count from the Vstr_ref (Parameter[1]), when the reference count reaches zero then the cleanup function will be called.
Parameter[1]: Vstr memory reference
Explanation: This function does nothing.
Parameter[1]: Vstr memory reference
Explanation: This will call free() on the Vstr_ref (Parameter[1]).
Parameter[1]: Vstr memory reference
Explanation: This will call free() on the data in the Vstr_ref (Parameter[1])->ptr (unless the passed reference is the NULL pointer, then it does nothing).
Parameter[1]: Vstr memory reference
Explanation: This will call free() on the data in the Vstr_ref (Parameter[1])->ptr and then call free() on the Vstr_ref (Parameter[1]) (unless the passed reference is the NULL pointer, then it does nothing).
Parameter[1]: Size of malloc'd area to create in the memory
reference
Explanation: This function will create an area of memory, using malloc, and create a Vstr memory reference to that memory. The Vstr memory reference will have a reference count of 1 and the cleanup function will point to a function to free both the reference and the copy of memory.
Parameter[1]: Pointer to memory
Parameter[2]: Function callback for Vstr memory reference
Explanation: This function will call malloc() to create a Vstr memory reference. The Vstr memory reference will have a reference count of 1, a pointer value of pointer passed (Parameter[1]) and a cleanup function of the function passed (Parameter[2]).
Parameter[1]: Pointer to memory
Parameter[2]: Length of memory block
Explanation: This function will create a Vstr memory reference. The Vstr memory reference will have a reference count of 1 and a copy of the memory pointed to by (Parameter[1]) of length (Parameter[2]) will be the pointer value. The cleanup function will point to a function to free both the reference and the copy of memory.
Parameter[1]: Pointer to data
Explanation: This function calls vstr_ref_make_memdup() with the length being the value of (strlen() + 1) on the data parameter (Parameter[1]).
Parameter[1]: Pointer to data
Explanation: This macro function calls vstr_ref_make_memdup() with the length being the value of (strlen() + 1) on the data parameter (Parameter[1]).
Parameter[1]: Vstr string
Explanation: This function will create a Vstr memory reference. The Vstr memory reference will have a reference count of 1, a pointer value of the Vstr string (Parameter[1]). The cleanup function will point to a function to free both the reference and the Vstr string.
Parameter[1]: Vstr configuration
Explanation: This function will create a Vstr memory reference. The Vstr memory reference will have a reference count of 1, a pointer value of the Vstr configuration (Parameter[1]). The cleanup function will point to a function to free both the reference and the Vstr configuration.
Parameter[1]: Vstr sections
Explanation: This function will create a Vstr memory reference. The Vstr memory reference will have a reference count of 1, a pointer value of the Vstr sections (Parameter[1]). The cleanup function will point to a function to free both the reference and the Vstr sections. Creation/destruction of core objectsFunction: vstr_make_conf() Returns: Vstr configuration Type: struct Vstr_conf * Parameter[1]: Nothing
Explanation: This function will make a Vstr configuration, or return NULL.
Parameter[1]: Vstr configuration
Explanation: This function will free a Vstr configuration, allocated by vstr_make_conf().
Parameter[1]: Vstr configuration
Explanation: This function will make a Vstr string, or return NULL. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. If there are spare base objects, then no allocations are done.
Parameter[1]: Vstr string
Explanation: This function will free a Vstr string, allocated by vstr_make_base(). Note: If the base object VSTR_CNTL_BASE_GET_TYPE_GRPALLOC_CACHE is of the same type as it's configurations VSTR_CNTL_CONF_GET_TYPE_GRPALLOC_CACHE, then the base object will be turned into a spare object so it can be reused by vstr_make_base().
Parameter[1]: Vstr configuration
Parameter[2]: Pointer to data
Parameter[3]: Length of data (Parameter[2])
Explanation: This function is equivalent to calling vstr_make_base() and then vstr_add_buf().
Parameter[1]: Vstr configuration
Parameter[2]: Pointer to data
Parameter[3]: Length of data (Parameter[2])
Explanation: This function is equivalent to calling vstr_make_base() and then vstr_add_ptr().
Parameter[1]: Vstr configuration
Parameter[2]: Length of non data
Explanation: This function is equivalent to calling vstr_make_base() and then vstr_add_non().
Parameter[1]: Vstr configuration
Parameter[2]: Vstr memory reference
Parameter[3]: Offset of Vstr memory reference
(Parameter[2])
Parameter[4]: Length of Vstr memory reference
(Parameter[2])
Explanation: This function is equivalent to calling vstr_make_base() and then vstr_add_ref().
Parameter[1]: Vstr configuration
Parameter[2]: Vstr string
Parameter[3]: Start position in the Vstr string
(Parameter[2])
Parameter[4]: Length in the Vstr string (Parameter[2])
Parameter[6]: Flags for Vstr add (VSTR_TYPE_ADD_*)
Explanation: This function is equivalent to calling vstr_make_base() and then vstr_add_vstr().
Parameter[1]: Vstr configuration
Parameter[2]: Character to repeat
Parameter[3]: Number of times to repeat character
(Parameter[2])
Explanation: This function is equivalent to calling vstr_make_base() and then vstr_add_rep_chr().
Parameter[1]: Vstr configuration
Parameter[2]: Pointer to data
Explanation: This function calls vstr_dup_buf() with the length being the value of strlen() on the data parameter (Parameter[2]).
Parameter[1]: Vstr configuration
Parameter[2]: Pointer to data
Explanation: This function calls vstr_dup_ptr() with the length being the value of strlen() on the data parameter (Parameter[2]).
Parameter[1]: Vstr string
Parameter[2]: Vstr memory reference
Parameter[3]: Offset of Vstr memory reference
(Parameter[3])
Explanation: This function calls vstr_dup_ref() with the length being the value of strlen() on the memory from the Vstr memory reference (Parameter[3]) starting at the offset (Parameter[4]).
Parameter[1]: Vstr configuration
Parameter[2]: Pointer to data
Explanation: This macro function calls vstr_dup_buf() with the length being the value of strlen() on the data parameter (Parameter[2]).
Parameter[1]: Vstr configuration
Parameter[2]: Pointer to data
Explanation: This macro function calls vstr_dup_ptr() with the length being the value of strlen() on the data parameter (Parameter[2]).
Parameter[1]: Vstr string
Parameter[2]: Vstr memory reference
Parameter[3]: Offset of Vstr memory reference
(Parameter[3])
Explanation: This macro function calls vstr_dup_ref() with the length being the value of strlen() on the memory from the Vstr memory reference (Parameter[3]) starting at the offset (Parameter[4]).
Parameter[1]: Vstr configuration
Parameter[2]: Type of nodes to create
Parameter[3]: Number of nodes to create
Explanation: This function will try and create a number (Parameter[3]) of nodes of type (Parameter[2]). Note: The number of nodes created will be less than or equal to the number requested (Parameter[3]), however if it is less than then the malloc_bad flag will be set (Parameter[1])->malloc_bad. If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Vstr configuration
Parameter[2]: Type of nodes to destroy
Parameter[3]: Number of nodes to destroy
Explanation: This function will try and destroy a number (Parameter[3]) of nodes of type (Parameter[2]). Note: The number of nodes destroyed will be less than or equal to the number requested (Parameter[3]), the only reason that less will be destroyed is if there are no more unused nodes of that type (Parameter[2]). If the configuration (Parameter[1]) is NULL, then the global configuration is used. Adding and deleting of data functionsFunction: vstr_add_buf() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Pointer to data
Parameter[4]: Length of data (Parameter[3])
Explanation: This function is used to add a copy of the data in the data array to a Vstr string. Think of this function as doing a write() into a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Pointer to data
Parameter[4]: Length of data (Parameter[3])
Explanation: This function is used to add a pointer to a data array to a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: If the data in the array needs to be free'd the programer will have to decide when it is no longer being used by the Vstr string and free it. It is often easier to create a memory reference and use vstr_add_ref() instead.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Length of non data
Explanation: This function is used to add "non" (or invisible) data to a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Vstr memory reference
Parameter[4]: Offset of Vstr memory reference
(Parameter[3])
Parameter[5]: Length of Vstr memory reference
(Parameter[3])
Explanation: This function is used to add a memory reference to a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Vstr string
Parameter[4]: Start position in the Vstr string
(Parameter[3])
Parameter[5]: Length in the Vstr string (Parameter[3])
Parameter[6]: Type for Vstr add (VSTR_TYPE_ADD_*)
Explanation: This function is used to add data in one Vstr string (Parameter[3]) to another Vstr string (Parameter[1]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The function can change how the data is added to the Vstr string (Parameter[1]) and in some cases even how the data is represented in the Vstr string (Parameter[3]) for more information see the documentation on the VSTR_TYPE_ADD_* constants. This function will set _both_ (Parameter[1])->conf->malloc_bad and (Parameter[3])->conf->malloc_bad if any of the allocation calls fails.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Character to repeat
Parameter[4]: Number of times to repeat character
(Parameter[3])
Explanation: This function is used to add 1 or more copies of the character (Parameter[3]) to the Vstr string. Think of this function as doing a memset() into data in the Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Pointer to data
Explanation: This function calls vstr_add_buf() with the length being the value of strlen() on the data parameter (Parameter[3]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Pointer to data
Explanation: This function calls vstr_add_ptr() with the length being the value of strlen() on the data parameter (Parameter[3]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Vstr memory reference
Parameter[4]: Offset of Vstr memory reference
(Parameter[3])
Explanation: This function calls vstr_add_ref() with the length being the value of strlen() on the memory from the Vstr memory reference (Parameter[3]) starting at the offset (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Pointer to data
Explanation: This macro function calls vstr_add_buf() with the length being the value of strlen() on the data parameter (Parameter[3]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Pointer to data
Explanation: This macro function calls vstr_add_ptr() with the length being the value of strlen() on the data parameter (Parameter[3]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Vstr memory reference
Parameter[4]: Offset of Vstr memory reference
(Parameter[3])
Explanation: This macro function calls vstr_add_ref() with the length being the value of strlen() on the memory from the Vstr memory reference (Parameter[3]) starting at the offset (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Format string, a superset of the rules for
C99 printf
Parameter[4]: Standard argument object from va_start()
Explanation: This function works like calling vsprintf() directly into a Vstr string, however this is a portable implementation which is feature complete with glibc-2.2.x sprintf(); implements custom specifiers, if you use the vstr_fmt_add() function, and doesn't require a double copy. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: Depending on how the library was compiled double support is implemented by either calling the underlying host implementation of sprintf(), by internal code or simply by assuming all double's are zero. When using the host implementation system bugs of inaccuracy will show through, however the feature set remains the same (Ie. the ' flag works the same). Because specifiers can be overridden using vstr_fmt_add() if you are adding data to a Vstr string that you didn't create you should use either vstr_add_vsysfmt() or vstr_swap_conf().
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Format string, a superset of the rules for
C99 printf
Parameter[4]: Options depending on value of Parameter[3]
Explanation: This just calls vstr_add_vfmt() after converting the argument list (Parameter[4]) a va_list object.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Format string, a superset of the rules for
C99 printf
Parameter[4]: Standard argument object from va_start()
Explanation: This function does the same thing as vstr_add_vfmt() but ignores custom specifiers (see vstr_fmt_add()).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Format string, a superset of the rules for
C99 printf
Parameter[4]: Options depending on value of Parameter[3]
Explanation: This just calls vstr_add_vsysfmt() after converting the argument list (Parameter[4]) a va_list object.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Minimum amount of iovecs to add
Parameter[4]: Maximum amount of iovecs to add
Parameter[5]: Returns the start of the iovec array
Parameter[6]: Returns the number of iovec structures in the
array
Explanation: This function is used to add a copy of data directly into the Vstr string, the amount of data available will be between the minimum (Parameter[4]) and maximum ((Parameter[5]) + 1) number of iovecs multiplied by the length of data in _BUF type nodes. The obvious use for the data is to call readv() on it. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: You shouldn't call any other vstr functions between vstr_add_iovec_buf_beg() and vstr_add_iovec_buf_end(), unless you know that they are operating on a different Vstr string which is using a different Vstr configuration. The reason there is a +1 on the maximum value is that data may be appended to a _BUF node just before the start of where the data is to go, this is almost guaranteed to happen when adding to the end of a Vstr string and saves a lot of wasted space. It is currently believed that, on Linux, doing disk IO in amounts greater than 8k gives little real performance improvement. This can be converted into iovec numbers by using a formula like... min = (8k / buf_sz) + 2; max = min + (min / 2); ...where the +2 is due to both the extra space at the end of the current last node, and rounding errors due to the division. The max being slightly bigger is an attempt to make the constant overhead of the call slightly less, and may not be useful. It is very possible that some kind of dynamic scaling of the values would result in the best performance, however the solution to that doesn't fit in the margin :).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Number of bytes added to the iovec array
Explanation: This function is used after calling vstr_add_iovec_buf_beg() and you've then filled in a bunch of data. Note:
Although it's safe to not bother calling this function if you didn't have
anything to add to the Vstr string it is often more efficient to call this
function with Parameter[3] as 0.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Explanation: This function creates the start of a netstring http://cr.yp.to/proto/netstrings.txt this can be used in conjunction with vstr_add_netstr_end() to easily create netstrings.
Parameter[1]: Vstr string
Parameter[2]: Position returned from vstr_add_netstr_beg()
Parameter[3]: End of netstring
Explanation: This function is called after calling vstr_add_netstr_beg(), adding all the data you want to the netstring and then passing the position of the end of that data. Upon success a valid netstring will contain all the data added between the two calls. Note: It is valid to pass the same values for (Parameter[2]) and (parameter[3]), as that signifies that there is no data in the netstring. It is almost guaranteed that data will need to be removed from the beginning of the netstring due to the length being shorter than the maximum, this is inefficient and could cause problems if you know how big the Vstr string is you can use the vstr_add_netstr2_* functions to solve both problems.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Explanation: This function creates the start of a netstring2 which is like a netstring http://cr.yp.to/proto/netstrings.txt but can have leading zeros, this can be used in conjunction with vstr_add_netstr2_end() to easily create netstring2s.
Parameter[1]: Vstr string
Parameter[2]: Position returned from vstr_add_netstr2_beg()
Parameter[3]: End of netstring2
Explanation: This function is called after calling vstr_add_netstr2_beg(), adding all the data you want to the netstring2 and then passing the position of the end of that data. Upon success a netstring2 will contain all the data added between the two calls. Note: It is valid to pass the same values for (Parameter[2]) and (parameter[3]), as that signifies that there is no data in the netstring. No data is ever removed from the beginning of a netstring2, this is incompatible with the netstring spec. but is more efficient and doesn't cause problems if you know how big the Vstr string is and can't have it lose data from the beginning/middle.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function is used to delete data in the Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: Deleted nodes do not get returned to the system, they get put into a pool in the Vstr configuration for reuse on the next call to a vstr_add_*() function. Deleting the entire Vstr string and deleting from the beginning onward are faster operations than a generic delete. They also never require allocating memory and so the return value can be ignored.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Vstr string
Parameter[4]: Start position in the Vstr string
(Parameter[3])
Parameter[5]: Length in the Vstr string (Parameter[3])
Explanation: This function is used to move data, deleting it from one Vstr string (Parameter[3]) and adding it to another Vstr string (Parameter[1]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Substitution of data functionsFunction: vstr_sub_buf() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to substitute the data in the Vstr string with a copy of the data in the data array. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The length of the Vstr string (Parameter[3]) can be larger or smaller than the length of the data (Parameter[5]). Think of this function as doing a vstr_del() and then a vstr_add_buf() (but it's atomic). If the length of the data (Parameter[5]) is less than or equal to the length of the Vstr string (Parameter[3]) and the data in the Vstr string is in a BUF node then the data will just be overwritten (Ie. no allocations will happen).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to substitute the data in the Vstr string with a pointer to a data array. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The length of the Vstr string (Parameter[3]) can be larger or smaller than the length of the data (Parameter[7]), think of this function like doing a vstr_del() and then a vstr_add_ptr() (but it's atomic).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Length of non data
Explanation: This function is used to substitute the data in the Vstr string with "non" (or invisible) data. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The length of the Vstr string (Parameter[3]) can be larger or smaller than the length of the data (Parameter[7]), think of this function like doing a vstr_del() and then a vstr_add_non() (but it's atomic).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr memory reference
Parameter[5]: Offset of Vstr memory reference
(Parameter[4])
Parameter[6]: Length of Vstr memory reference
(Parameter[4])
Explanation: This function is used to substitute the data in the Vstr string with a memory reference. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The length of the Vstr string (Parameter[3]) can be larger or smaller than the length of the data (Parameter[7]), think of this function like doing a vstr_del() and then a vstr_add_ref() (but it's atomic).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Parameter[6]: Type for Vstr sub (VSTR_TYPE_SUB_*)
Explanation: This function is used to substitute the data in the Vstr string (Parameter[1]) with the data in another Vstr string (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The length of the Vstr string (Parameter[3]) can be larger or smaller than the length of the data (Parameter[7]), think of this function like doing a vstr_del() and then a vstr_add_vstr() (but it's atomic). The function can change how the data is added to the Vstr string (Parameter[1]) and in some cases even how the data is represented in the Vstr string (Parameter[3]) for more information see the documentation on the VSTR_TYPE_SUB_* constants.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Character to repeat
Parameter[5]: Number of times to repeat character
(Parameter[3])
Explanation: This function is used to substitute the data in the Vstr string with one or more copies of the character (Parameter[3]). Think of this function as doing a memset() into data in the Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. The function will return 0 if it needs to allocate memory and cannot do so, although if it does fail the Vstr string won't have changed (Ie. the function is atomic). Note: The length of the Vstr string (Parameter[3]) can be larger or smaller than the length of the data (Parameter[5]). Think of this function as doing a vstr_del() and then a vstr_add_rep_chr() (but it's atomic). If the length of the data (Parameter[5]) is equal to the length of the Vstr string (Parameter[3]) and the data in the Vstr string is in a BUF node then the data will just be overwritten (Ie. no allocations will happen).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_sub_buf() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_sub_ptr() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr memory reference
Parameter[5]: Offset of Vstr memory reference
(Parameter[4])
Explanation: This function calls vstr_sub_ref() with the length being the value of strlen() on the memory from the Vstr memory reference (Parameter[3]) starting at the offset (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_sub_buf() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_sub_ptr() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr memory reference
Parameter[5]: Offset of Vstr memory reference
(Parameter[4])
Explanation: This macro function calls vstr_sub_ref() with the length being the value of strlen() on the memory from the Vstr memory reference (Parameter[3]) starting at the offset (Parameter[4]). Comparison of data functionsFunction: vstr_cmp() Returns: Less then zero, zero or greater than zero depending on comparison Type: int Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is used to compares the data in one Vstr string (Parameter[1]) with data in another Vstr string (Parameter[4]) byte by byte, all data is compared unsigned. Think of this function as doing a vstr_export_cstr_ptr() on each Vstr string, and then a call to memcmp() (although it doesn't allocate anything). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: Data of type _NON is assumed to have the value -1, and so all data compares as greater than it.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is like vstr_cmp() but uppercase and lowercase ASCII values compare equally with each other. Note: Data of type _NON is assumed to have the value -1, and so all data compares as greater than it.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_case().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is like vstr_cmp() but it is meant to provide "fast" results for use in internal comparisons (Ie. output is unlikely to be enjoyed by humans). Note: Data of type _NON is assumed to have the value -1, and so all data compares as greater than it.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_fast().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is used to compare the data in one Vstr string (Parameter[1]) with data in another Vstr string (Parameter[4]), however for ASCII digits the algorithm tests on the numbers themselves (so "10" is greater than "9" but "01" is greater than "012", as the later are fractions). Think of this function as doing a vstr_export_cstr_ptr() on each Vstr string, and then a call to strverscmp() (although it doesn't allocate anything, _and_ it deals with 0 bytes in the data). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: Data of type _NON is assumed to have the value -1, and so all data compares as greater than it.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_vers().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp() if both of the length values (Parameter[3] Parameter[6]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_buf() if both of the length values (Parameter[3] Parameter[5]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function returns !vstr_cmp_buf(), if both of the length values are equal, with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_case() if both of the length values (Parameter[3] Parameter[6]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_case_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: This function returns !vstr_cmp_case_buf() if both of the length values (Parameter[3] Parameter[5]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function returns !vstr_cmp_case_buf(), if both of the length values are equal, with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_fast_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_vers() if both of the length values (Parameter[3] Parameter[6]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_vers_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: This function returns !vstr_cmp_vers_buf() if both of the length values (Parameter[3] Parameter[5]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function returns !vstr_cmp_vers_buf(), if both of the length values are equal, with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function calls vstr_cmp() with the both lengths as the lowest of either passed length (Parameter[3]) or (Parameter[6]). Thus you get a comparison of the beginning of the data in the two strings.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function calls vstr_cmp() with the both lengths as the lowest of either passed length (Parameter[3]) or (Parameter[6]) and with the positions (Parameter[3]) and (Parameter[6]) changed so that the length of each goes to the end of the string. Thus you get a comparison of the end of the data in the two strings.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_bod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_eod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_bod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_eod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_bod_buf().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_eod_buf().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_bod_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_eod_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_bod_buf_eq() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_eod_buf_eq() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function calls vstr_cmp_case() with the both lengths as the lowest of either passed length (Parameter[3]) or (Parameter[6]). Thus you get a comparison of the beginning of the data in the two strings.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function calls vstr_cmp_case() with the both lengths as the lowest of either passed length (Parameter[3]) or (Parameter[6]) and with the positions (Parameter[3]) and (Parameter[6]) changed so that the length of each goes to the end of the string. Thus you get a comparison of the end of the data in the two strings.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_case_bod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_case_eod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_case_bod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_case_eod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_case_bod_buf().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_case_eod_buf().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_case_bod_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_case_eod_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_case_bod_buf_eq() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_case_eod_buf_eq() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function calls vstr_cmp_vers() with the both lengths as the lowest of either passed length (Parameter[3]) or (Parameter[6]). Thus you get a comparison of the beginning of the data in the two strings.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function calls vstr_cmp_vers() with the both lengths as the lowest of either passed length (Parameter[3]) or (Parameter[6]) and with the positions (Parameter[3]) and (Parameter[6]) changed so that the length of each goes to the end of the string. Thus you get a comparison of the end of the data in the two strings.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_vers_bod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function returns !vstr_cmp_vers_eod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_vers_bod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: Think of this function as doing a vstr_dup_ptr() on the data array (Parameter[4]) and then calling vstr_cmp_vers_eod().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_vers_bod_buf().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of data (Parameter[4])
Explanation: This function returns !vstr_cmp_vers_eod_buf().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_vers_bod_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_vers_eod_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_vers_bod_buf_eq() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This function calls vstr_cmp_vers_eod_buf_eq() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This macro function returns !vstr_cmp() if both of the length values (Parameter[3] Parameter[6]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This macro function calls vstr_cmp_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This macro function returns !vstr_cmp_buf() if both of the length values (Parameter[3] Parameter[5]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This macro function returns !vstr_cmp_buf(), if both of the length values are equal, with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This macro function returns !vstr_cmp_case() if both of the length values (Parameter[3] Parameter[6]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This macro function calls vstr_cmp_case_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: This macro function returns !vstr_cmp_case_buf() if both of the length values (Parameter[3] Parameter[5]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This macro function returns !vstr_cmp_case_buf(), if both of the length values are equal, with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This macro function returns !vstr_cmp_vers() if both of the length values (Parameter[3] Parameter[6]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This macro function calls vstr_cmp_vers_buf() with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Parameter[5]: Length of ASCII C string (Parameter[4])
Explanation: This macro function returns !vstr_cmp_vers_buf() if both of the length values (Parameter[3] Parameter[5]) are equal, or FALSE otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to ASCII C string
Explanation: This macro function returns !vstr_cmp_vers_buf(), if both of the length values are equal, with the length of the buffer being the value of strlen() on the data parameter (Parameter[4]). Searching for data functionsFunction: vstr_srch_chr_fwd() Returns: Position in the Vstr string of the character Type: size_t Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Character to search for
Explanation: This function is used to search forward for a character in a Vstr string. Think of this function as doing a vstr_export_cstr_ptr() on the Vstr string, and then a call to memchr() (although it's much faster than doing that and doesn't allocate anything). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the character cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Character
Explanation: This function is used to search reverse for a character in a Vstr string. Think of this function as doing a vstr_export_cstr_ptr() on the Vstr string, and then a call to memrchr() (although it doesn't allocate anything). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the character cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to search forward for any of the characters in the data array (Parameter[4]) in a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If any of the characters cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to search reverse for any of the characters in the data array (Parameter[4]) in a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If any of the characters cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to search forward for any of the characters not in the data array (Parameter[4]) in a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If any of the characters cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to search reverse for any of the characters not in the data array (Parameter[4]) in a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If any of the characters cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to search forward for the data in the data array (Parameter[4]) in a Vstr string. Think of this function as doing a vstr_export_cstr_ptr() on the Vstr string, and then a call to memmem() (although it's much faster than doing that and doesn't allocate anything). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the data cannot be found 0 is returned. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the specified size (Parameter[5]) will be searched for.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is used to search reverse for the data in the data array (Parameter[4]) in a Vstr string. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the data cannot be found 0 is returned. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the specified size (Parameter[5]) will be searched for.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is used to search forward for the data in the Vstr string (Parameter[4]) in the Vstr string (Parameter[1]). Think of this function as doing a vstr_export_cstr_ptr() on each Vstr string, and then a call to memmem() (although it's much faster than doing that and doesn't allocate anything). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the data cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is used to search reverse for the data in the Vstr string (Parameter[4]) in the Vstr string (Parameter[1]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the data cannot be found 0 is returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Character to search for
Explanation: This function is the same as vstr_srch_chr_fwd() but uppercase and lowercase ASCII values are treated equivalently.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Character
Explanation: This function is the same as vstr_srch_chr_rev() but uppercase and lowercase ASCII values are treated equivalently.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is the same as vstr_srch_buf_fwd() but uppercase and lowercase ASCII values are treated equivalently. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the specified size (Parameter[5]) will be searched for.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is the same as vstr_srch_buf_fwd() but uppercase and lowercase ASCII values are treated equivalently. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the specified size (Parameter[5]) will be searched for.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is the same as vstr_srch_vstr_fwd() but uppercase and lowercase ASCII values are treated equivalently.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr string
Parameter[5]: Start position in the Vstr string
(Parameter[4])
Parameter[6]: Length in the Vstr string (Parameter[4])
Explanation: This function is the same as vstr_srch_vstr_rev() but uppercase and lowercase ASCII values are treated equivalently.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_srch_buf_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_srch_buf_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_srch_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_srch_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_csrch_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_csrch_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_srch_case_buf_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This function calls vstr_srch_case_buf_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_srch_buf_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_srch_buf_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_srch_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_srch_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_csrch_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_csrch_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_srch_case_buf_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_srch_case_buf_rev() with the length being the value of strlen() on the data parameter (Parameter[4]). Span of data calculation functionsFunction: vstr_spn_bmap_eq_fwd() Returns: Number of characters in the span Type: size_t Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Value to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the forward span of bytes, that have the value (Parameter[5]) in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Value to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the reverse span of bytes, that have the value (Parameter[5]) in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Bits to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the forward span of bytes, that have any bit set, in the value (Parameter[5]), in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Bits to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the reverse span of bytes, that have any bit set, in the value (Parameter[5]), in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Parameter[5]: Length of spanning characters (Parameter[4])
Explanation: This function is used to calculate the forward span of characters in the Vstr string that are in the data array. Think of this function as doing a vstr_export_cstr_ptr() on the Vstr string, and then a call to strspn() (although it's much faster than doing that and doesn't allocate anything, _and_ it deals with 0 bytes in the data). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the size 1 will be looked for in the span.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Parameter[5]: Length of spanning characters (Parameter[4])
Explanation: This function is used to calculate the reverse span of characters in the Vstr string that are in the data array. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the size 1 will be looked for in the span.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Value to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the forward complement span of bytes, that have the value (Parameter[5]) in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Value to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the reverse complement span of bytes, that have the value (Parameter[5]) in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Bits to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the forward complement span of bytes, that have any bit set, in the value (Parameter[5]), in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to bytemap
Parameter[5]: Bits to compare against in bytemap
(Parameter[4])
Explanation: This function is used to calculate the reverse complement span of bytes, that have any bit set, in the value (Parameter[5]), in the bytemap (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Parameter[5]: Length of spanning characters (Parameter[4])
Explanation: This function is used to calculate the forward span of characters in the Vstr string that are in the compliment of those in the data array. Think of this function as doing a vstr_export_cstr_ptr() on the Vstr string, and then a call to strcspn() (although it's much faster than doing that and doesn't allocate anything, _and_ it deals with 0 bytes in the data). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the size 1 will not be looked for in the span.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Parameter[5]: Length of spanning characters (Parameter[4])
Explanation: This function is used to calculate the reverse span of characters in the Vstr string that are in the compliment of those in the data array. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: If the pointer to data (Parameter[4]) is NULL then _NON data of the size 1 will not be looked for in the span.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This function calls vstr_spn_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This function calls vstr_spn_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This function calls vstr_cspn_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This function calls vstr_cspn_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This function calls vstr_spn_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This function calls vstr_spn_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This macro function calls vstr_cspn_chrs_fwd() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to spanning characters
Explanation: This macro function calls vstr_cspn_chrs_rev() with the length being the value of strlen() on the data parameter (Parameter[4]). Convertion of data functionsFunction: vstr_conv_lowercase() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function converts all the uppercase ASCII characters into lowercase ASCII characters.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function converts all the lowercase ASCII characters into uppercase ASCII characters.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Flags starting VSTR_FLAG_CONV_UNPRINTABLE_*
Parameter[5]: Character to substitute in place of the
unprintable character
Explanation: This function substitutes all unprintable characters with the substitution character (Parameter[5]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Flags starting VSTR_FLAG_CONV_UNPRINTABLE_*
Explanation: This function deletes all unprintable characters.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function converts characters to the URI %<hex><hex> encoding, so the ASCII space character ' ' becomes the encoded sequence %20 etc. Note: It converts all the characters in section 2.4.3 of rfc2396 into encoded form (that's all of the control, space, unwise and high ASCII characters).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function converts characters from the URI %<hex><hex> encoding, so that the encoded sequence %20 becomes the ASCII space character ' ' etc. Section of Vstr string functionsFunction: VSTR_SECTS_DECL() Returns: Declaration of a Vstr sections Type: struct Vstr_sects * Parameter[1]: Name of variable to declare
Parameter[2]: Maximum size of the Vstr sections
(Parameter[1])
Explanation: This macro function declares a Vstr sections, of the specified size (Parameter[2]). Note: VSTR_SECTS_DECL_INIT() needs to be called on the Vstr sections before it can be used.
Parameter[1]: Name of variable to declare
Parameter[2]: Maximum size of the Vstr sections
Explanation: This macro function declares a Vstr sections, of the specified size (Parameter[2]), that is usable after an extern keyword.
Parameter[1]: Vstr sections
Explanation: This macro function finishes initializing a Vstr sections that has been allocated using VSTR_SECTS_DECL(). This macro function can be called multiple times without causing any problems.
Parameter[1]: Vstr sections
Parameter[2]: Maximum number of the Vstr sections
Parameter[3]: Array of Vstr section nodes
Parameter[4]: Non-zero if the nodes (Parameter[3]) can be
passed to free()
Explanation: The macro function initializes a self declared Vstr sections. Note: Unlike VSTR_SECTS_DECL_INIT() this should only be called once per initialization.
Parameter[1]: Vstr sections
Parameter[2]: Number of the section in the Vstr sections
(Parameter[1])
Explanation: Simple way to goto the Vstr section node in a Vstr sections.
Parameter[1]: Maximum number of the Vstr sections
Explanation: This function will make a Vstr sections, or return NULL.
Parameter[1]: Vstr sections
Explanation: This function will free a Vstr sections, allocated by vstr_sects_make().
Parameter[1]: Vstr sections
Parameter[2]: Position in a Vstr string
Parameter[3]: Length in a Vstr string
Explanation: This function will add the position and length to a Vstr section node at the end of the Vstr sections (Parameter[1]). If space is not available and (Parameter[1])->can_add_sz is TRUE, then space try to be allocated.
Parameter[1]: Vstr sections
Parameter[2]: Number of the section in the Vstr sections
(Parameter[1])
Explanation: This function will delete a specified Vstr section node. If (Parameter[1])->can_del_sz is TRUE then space may be compacted.
Parameter[1]: Vstr string
Parameter[2]: Vstr sections
Parameter[3]: Flags starting VSTR_FLAG_SECT_FOREACH_*
Parameter[4]: Function to run as foreach body
Parameter[5]: Data to pass to foreach body function
(Parameter[4])
Explanation: This function will run the foreach body function (Parameter[4]) on every valid Vstr section node in the Vstr sections. The callback function (Parameter[4]) is passed the Vstr string (Parameter[1]), the position and length from the current Vstr section node and finally the caller supplied data (Parameter[5]). Note: The foreach callback body function returns types starting VSTR_TYPE_SECT_FOREACH_.
Parameter[1]: Vstr string
Parameter[2]: Vstr sections
Explanation: This function will cause the section (Parameter[2]) to automatically be updated when changes are made to the Vstr string (Parameter[1]). Note: You need to call vstr_sects_update_del(), before you free the section (Parameter[2]). However if the next thing you are going to do is call vstr_free_base() on the Vstr string (Parameter[1]), then nothing bad will happen if you call them in the oposite order. This uses the vstr_cache_add() function.
Parameter[1]: Vstr string
Parameter[2]: Vstr sections
Explanation: This function will cause the section (Parameter[2]) that was previously updated when changes are made to the Vstr string (Parameter[1]) to not be updated anymore.
Parameter[1]: Vstr sections
Parameter[2]: Position in a Vstr string
Parameter[3]: Length in a Vstr string
Explanation: This function will search for the first Vstr section node in a Vstr section (Parameter[1]) that matches the position and length. Splitting data into sections functionsFunction: vstr_split_buf() Returns: Number of Vstr section nodes added to the Vstr sections Type: unsigned int Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data to split on
Parameter[5]: Length of data (Parameter[4])
Parameter[6]: Vstr sections
Parameter[7]: Limit of sections to add to Vstr sections
(Parameter[6])
Parameter[8]: Flags starting VSTR_FLAG_SPLIT_*
Explanation: This function is used to add section nodes to the Vstr sections (Parameter[6]) about the Vstr string (Parameter[1]). The function will add one section before each occurrence of the data (Parameter[4]), and one final section for the rest of the Vstr string. If the limit (Parameter[7]) is non-zero then ((Parameter[7]) - 1) occurrences of the data will be searched for and one final section will be added for the rest of the Vstr string. This means that "a:b:c" if split on ":" with a limit of 2 will split into "a" and "b:c", and that "a::" if split on ":" with a limit of 2 will split into "a" and ":".
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to characters to split on
Parameter[5]: Length of characters (Parameter[4])
Parameter[6]: Vstr sections
Parameter[7]: Limit of sections to add to Vstr sections
(Parameter[6])
Parameter[8]: Flags starting VSTR_FLAG_SPLIT_
Explanation: This function works like vstr_split_buf() except that instead of having to match all the data in the data buffer it matches any of the characters in the character buffer (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data to split on
Parameter[5]: Vstr sections
Parameter[6]: Limit of sections to add to Vstr sections
(Parameter[6])
Parameter[7]: Flags starting VSTR_FLAG_SPLIT_*
Explanation: This function calls vstr_split_buf() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to characters to split on
Parameter[5]: Vstr sections
Parameter[6]: Limit of sections to add to Vstr sections
(Parameter[6])
Parameter[7]: Flags starting VSTR_FLAG_SPLIT_*
Explanation: This function calls vstr_split_chrs() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to data to split on
Parameter[5]: Vstr sections
Parameter[6]: Limit of sections to add to Vstr sections
(Parameter[6])
Parameter[7]: Flags starting VSTR_FLAG_SPLIT_*
Explanation: This macro function calls vstr_split_buf() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Pointer to characters to split on
Parameter[5]: Vstr sections
Parameter[6]: Limit of sections to add to Vstr sections
(Parameter[6])
Parameter[7]: Flags starting VSTR_FLAG_SPLIT_*
Explanation: This macro function calls vstr_split_chrs() with the length being the value of strlen() on the data parameter (Parameter[4]). Parsing data functionsFunction: vstr_parse_num() Returns: Data returned from callback function Type: void * Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Parameter[7]: Function to run as parse body
Parameter[8]: Data to pass to parse number callback
function (Parameter[7])
Explanation: This function will parse a number, and pass it piece by piece to the callback function (Parameter[7]). The callback function (Parameter[7]) is passed the base and the value of the current piece of the number, the pointer to a valid error code and finally the caller supplied data (Parameter[8]). Note: If NULL is returned from the callback function, then parsing will stop at that point and immediately return. A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range SHRT_MIN to SHRT_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range 0 to USHRT_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range INT_MIN to INT_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range 0 to UINT_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range LONG_MIN to LONG_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range 0 to ULONG_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range INTMAX_MIN to INTMAX_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise. If the intmax_t type is unavailable on the platform, then this function will act the same as vstr_parse_long().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Base to parse number in and flags starting
VSTR_FLAG_PARSE_NUM_
Parameter[5]: Returns length of number (Return)
Parameter[6]: Returns error code starting
VSTR_TYPE_PARSE_NUM_ERR_
Explanation: This function will parse a number, in the range 0 to UINTMAX_MAX, from the start of a Vstr string. The base that the number is parsed as is passed by specifying a number between 2 and 36 as part of the flags (Parameter[4]). Note: A base of 0 specifies that the base should be automatically detected, by choosing base 16 if the number starts 0x or 0X, base 2 if the number starts 0b or 0B, base 8 if the number starts with a 0 and defaulting to base 10 otherwise. If the intmax_t type is unavailable on the platform, then this function will act the same as vstr_parse_ulong().
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Returns the position of the start of the
netstring data
Parameter[5]: Returns the length of the data in the
netstring
Explanation: This function is used to search forward for the beginning of a netstring in the Vstr string (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the data cannot be found 0 is returned. Note: The netstring is only found if it is "whole", in that the entire netstring and data exist in the Vstr string. If one is found but is not whole then the position of the start of data and the length of the netstring will still be returned.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Returns the position of the start of the
netstring data
Parameter[5]: Returns the length of the netstring
Explanation: This function is used to search forward for the beginning of a netstring in the Vstr string (Parameter[4]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. If the data cannot be found 0 is returned. Note: The netstring is only found if it is "whole", in that the entire netstring and data exist in the Vstr string. If one is found but is not whole then the position of the start of data and the length of the netstring will still be returned. The specification of a netstring2 is a superset of the specification of a netstring, so this function will find either.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Returns ip in array elements 0 to 3
Parameter[5]: Returns CIDR mask, if requested
Parameter[6]: Flags starting VSTR_FLAG_PARSE_IPV4_*
Parameter[7]: Returns length of parsed ip address
(Parameter[4] Parameter[5])
Parameter[8]: Returns error code starting
VSTR_TYPE_PARSE_IPV4_ERR_
Explanation: This function will parse an ipv4 address, or optionally an ipv4 address and a CIDR mask / netmask, from the Vstr string.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Returns ip in array elements 0 to 7
Parameter[5]: Returns CIDR mask
Parameter[6]: Flags starting VSTR_FLAG_PARSE_IPV6_*
Parameter[7]: Returns length of parsed ip address
(Parameter[4] Parameter[5])
Parameter[8]: Returns error code starting
VSTR_TYPE_PARSE_IPV6_ERR_
Explanation: This function will parse an ipv6 address, or optionally an ipv6 address and a CIDR mask, from the Vstr string. Custom formatter functionsFunction: vstr_fmt_add() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Parameter[3]: Function to use as callback from
vstr_add_vfmt()
Parameter[4]: List of VSTR_TYPE_FMT_* types for format
specifier (Parameter[2])
Explanation: This function allows you to register arbitrary format specifiers for printing from vstr_add_fmt(). Note that these trigger off the user escape character, which may or may not be the same as the "system" escape character of '%'. The call back you register should return 0 (zero) if memory couldn't be allocated and 1 (one) otherwise. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. If the user escape character is '%', then you can override system specifiers by using a specifier name (Parameter[2]) of "i" etc. This isn't recommended, but is done so that you can have specifier names like "igloo" and it not be taken as a system specifier, however if you then did "%igoo" that would be interpreted as a "%i" (int) specification followed by the string "goo". You can register multiple names with one callback, so you can register say "{Vstr}" and "{Vstr:%p%zu%zu%u}" ... the latter, with a user escape != '%', will do the right thing with current printf warning checks in gcc. We can all hope that the former will be as usable eventually. If you register all your custom formatter names starting with one of "{", "[", "<" or "(" and ending with one of "}", "]", ">" or ")" and no other instances of those characters ... then matching custom formatters will be much faster.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function allows you to unregister a format specifier added using vstr_fmt_add(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function allows you to find out if a format specifier has been added using vstr_fmt_add(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Format specifier passed to a callback of
vstr_add_vfmt()
Parameter[2]: Number of the parameter passed to the
callback
Explanation: This macro function returns the nth (Parameter[2]) parameter passed to a callback of vstr_add_vfmt(), as a generic pointer.
Parameter[1]: Format specifier passed to a callback of
vstr_add_vfmt()
Parameter[2]: Type of the specified value
Parameter[3]: Number of the parameter for the callback
Explanation: This macro function returns the nth (Parameter[3]) parameter passed to a callback of vstr_add_vfmt(), by value. Short cut helper functionsFunction: vstr_sc_bmap_init_eq_spn_buf() Returns: Nothing Type: void Parameter[1]: Pointer to bytemap
Parameter[2]: Pointer to data
Parameter[3]: Length of a data (Parameter[2])
Parameter[4]: Value to set in bytemap (Parameter[4])
Explanation: This function is used to set all the bytes in the data (Parameter[2]), to the value (Parameter[4]) in the bytemap (Parameter[1]).
Parameter[1]: Pointer to bytemap
Parameter[2]: Pointer to data
Parameter[3]: Value to set in bytemap (Parameter[4])
Explanation: This function calls vstr_sc_bmap_init_eq_spn_buf() with the length being the value of strlen() on the data parameter (Parameter[2]).
Parameter[1]: Pointer to bytemap
Parameter[2]: Pointer to data
Parameter[3]: Length of a data (Parameter[2])
Parameter[4]: Value of bits to set in bytemap
(Parameter[1])
Explanation: This function is used to set all the bytes in the data (Parameter[2]), to the value (Parameter[4]) combined with the original value, in the bytemap (Parameter[1]).
Parameter[1]: Pointer to bytemap
Parameter[2]: Pointer to data
Parameter[3]: Value of bits to set in bytemap
(Parameter[1])
Explanation: This function calls vstr_sc_bmap_init_or_spn_buf() with the length being the value of strlen() on the data parameter (Parameter[2]).
Parameter[1]: Start position in a Vstr string
Parameter[2]: End position in a Vstr string
Explanation: This function is used to find the length between two positions inclusive.
Parameter[1]: Start position in a Vstr string
Parameter[2]: End position in a Vstr string
Explanation: This macro function is used to find the length between two positions inclusive.
Parameter[1]: Start position in a Vstr string
Parameter[2]: Length of a Vstr string
Explanation: This function is used to find the last poition, given a position and a length (it's basically the oposite of vstr_sc_posdiff()).
Parameter[1]: Start position in a Vstr string
Parameter[2]: Length of a Vstr string
Explanation: This macro function is used to find the last poition, given a position and a length (it's basically the oposite of VSTR_SC_POSDIFF()).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Length to reduce the Vstr string
(Parameter[1])
Explanation: This function is a helper function to reduce the Vstr string to the desired length (Ie. delete by a given ammount from the end of the given Vstr string). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Parameter[4]: Position of basename (Return)
Parameter[5]: Length of basename (Return)
Explanation: This function is a helper function to return the basename of a path. Unlike other implementations of this function nothing is allocated and altered in the original string Note: This function, with vstr_sc_dirname(), always returns values that can be combined to generate the original path. This means that this function will return an empty length for the path "/".
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation:
This function is a helper function to output a number with the Vstr strings
locale grouping characters, for a specific base.
If copies both user data and locale data.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Parameter[5]: Length of data (Parameter[4])
Explanation: This function is a helper function to output a number with the Vstr strings locale grouping characters, for a specific base. If uses pointers for the user data and memory references for the locale data.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Parameter[5]: Offset of Vstr memory reference
(Parameter[4])
Parameter[6]: Length of Vstr memory reference
(Parameter[4])
Explanation: This function is a helper function to output a number with the Vstr strings locale grouping characters, for a specific base. If uses memory references for the user data and the locale data.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Pointer to data
Parameter[4]: Length of data (Parameter[3])
Explanation: This function is a helper function to output a number with the Vstr strings locale grouping characters. If copies both user data and locale data. Note: This function always uses the default locale information, if you have setup specific number base locale information using VSTR_CNTL_CONF_GET_LOC_REF_* etc. then you'll want to use the vstr_sc_add_grpbasenum_* functions.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Explanation: This function calls vstr_sc_add_grpbasenum_buf() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Explanation: This function calls vstr_sc_add_grpbasenum_ptr() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Parameter[5]: Offset of Vstr memory reference
(Parameter[4])
Explanation: This function calls vstr_sc_add_grpbasenum_ref() with the length being the value of strlen() on memory from the Vstr memory reference (Parameter[4]) starting at offset (Parameter[5]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_sc_add_grpbasenum_buf() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Explanation: This macro function calls vstr_sc_add_grpbasenum_ptr() with the length being the value of strlen() on the data parameter (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Base of the number in the data
Parameter[4]: Pointer to data
Parameter[5]: Offset of Vstr memory reference
(Parameter[4])
Explanation: This macro function calls vstr_sc_add_grpbasenum_ref() with the length being the value of strlen() on memory from the Vstr memory reference (Parameter[4]) starting at offset (Parameter[5]).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Pointer to data
Explanation: This function calls vstr_sc_add_grpnum_buf() with the length being the value of strlen() on the data parameter (Parameter[3]). Note: This function always uses the default locale information, if you have setup specific number base locale information using VSTR_CNTL_CONF_GET_LOC_REF_* etc. then you'll want to use the vstr_sc_add_grpbasenum_* functions.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Pointer to data
Explanation: This macro function calls vstr_sc_add_grpnum_buf() with the length being the value of strlen() on the data parameter (Parameter[3]). Note: This macro always uses the default locale information, if you have setup specific number base locale information using VSTR_CNTL_CONF_GET_LOC_REF_* etc. then you'll want to use the vstr_sc_add_grpbasenum_* functions.
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Parameter[4]: Pointer to array of numbers in the current
base
Parameter[5]: Base to convert number in
Explanation: This function will convert a number (Parameter[3]) into an array of bytes, the number is converted by using the byte at the offset in the array of numbers (Parameter[4]).
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Explanation: This function will convert a number (Parameter[3]) into an array of numbers, in base 10, return value is the number of numbers written.
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Parameter[4]: Pointer to array of numbers in the current
base
Parameter[5]: Base to convert number in
Explanation: This function will convert a number (Parameter[3]) into an array of bytes, the number is converted by using the byte at the offset in the array of numbers (Parameter[4]).
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Explanation: This function will convert a number (Parameter[3]) into an array of numbers, in base 10, return value is the number of numbers written.
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Parameter[4]: Pointer to array of numbers in the current
base
Parameter[5]: Base to convert number in
Explanation: This function will convert a number (Parameter[3]) into an array of bytes, the number is converted by using the byte at the offset in the array of numbers (Parameter[4]).
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Explanation: This function will convert a number (Parameter[3]) into an array of numbers, in base 10, return value is the number of numbers written.
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Parameter[4]: Pointer to array of numbers in the current
base
Parameter[5]: Base to convert number in
Explanation: This function will convert a number (Parameter[3]) into an array of bytes, the number is converted by using the byte at the offset in the array of numbers (Parameter[4]).
Parameter[1]: Data array to export to
Parameter[2]: Length of data (Parameter[1])
Parameter[3]: Number to output
Explanation: This function will convert a number (Parameter[3]) into an array of numbers, in base 10, return value is the number of numbers written.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr
Parameter[3]: Length from position in the Vstr
Parameter[4]: Length of dirname (Return)
Explanation: This function is a helper function to return the directory of a path, excluding the basename. Unlike other implementations of this function nothing is allocated and nothing is altered in the original string. Note: This function, with vstr_sc_basename(), always returns values that can be combined to generate the original path. This means that this function will return an empty length for a relative filename in the current directory.
Parameter[1]: Vstr string
Parameter[2]: Position in the Vstr string (Parameter[1]),
updated for padding.
Parameter[3]: Format specifier passed to a callback of
vstr_add_vfmt()
Parameter[4]: Length of data you are going to add, updated
due to precision.
Parameter[5]: Flags starting VSTR_FLAG_SC_FMT_CB_BEG_*
Explanation: This function is a helper function for any custom format specifiers you write, it takes care of truncation of length due to precision (on strings only) and printing initial output for numbers or strings. Note:
If this function returns FALSE, you should probably just return from the
callback with FALSE.
Parameter[1]: Vstr string
Parameter[2]: Position you added your data to the Vstr
(Parameter[1]).
Parameter[3]: Format specifier passed to a callback of
vstr_add_vfmt()
Parameter[4]: Length of data you added.
Explanation: This function is a helper function for any custom format specifiers you write, it takes care of doing the standard transforms to your data after it is output as if you were printing a string. Note: You shouldn't alter the position between calling vstr_sc_fmt_cb_beg() and vstr_sc_fmt_cb_end(), if padding is added in vstr_sc_fmt_cb_end() it is added at position (Parameter[2]) + length (Parameter[4]). If this function returns FALSE, you should probably just return from the callback with FALSE.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print Vstr strings. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID, VSTR_TYPE_FMT_SIZE_T, VSTR_TYPE_FMT_SIZE_T, VSTR_TYPE_FMT_UINT and VSTR_TYPE_FMT_END. These correspond to the last 4 arguments to vstr_add_vstr(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. As you would expect the precision and field width values are used from the format, so the length of the Vstr string printed is the lower bound of the length passed and the precision. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{vstr}", with the gcc warning compatible alternates using "{vstr:%p%zu%zu%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a memory block. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_CHAR, VSTR_TYPE_FMT_SIZE_T and VSTR_TYPE_FMT_END. These correspond to the last 2 arguments to vstr_add_buf(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. As you would expect the precision and field width values are used from the format, so the length of the memory block printed is the lower bound of the length passed and the precision. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{buf}", with the gcc warning compatible alternates using "{buf:%s%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a memory block. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_CHAR, VSTR_TYPE_FMT_SIZE_T and VSTR_TYPE_FMT_END. These correspond to the last 2 arguments to vstr_add_ptr(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. As you would expect the precision and field width values are used from the format, so the length of the memory block printed is the lower bound of the length passed and the precision. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{ptr}", with the gcc warning compatible alternates using "{ptr:%s%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a memory block. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_SIZE_T and VSTR_TYPE_FMT_END. These correspond to the last argument to vstr_add_non(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. As you would expect the precision and field width values are used from the format, so the length of the memory block printed is the lower bound of the length passed and the precision. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{non}", with the gcc warning compatible alternates using "{non:%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a memory block. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID, VSTR_TYPE_FMT_SIZE_T, VSTR_TYPE_FMT_SIZE_T and VSTR_TYPE_FMT_END. These correspond to the last 3 arguments to vstr_add_ref(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. As you would expect the precision and field width values are used from the format, so the length of the memory block printed is the lower bound of the length passed and the precision. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{ref}", with the gcc warning compatible alternates using "{ref:%p%zu%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a memory block. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_INT, VSTR_TYPE_FMT_SIZE_T and VSTR_TYPE_FMT_END. These correspond to the last 2 arguments to vstr_add_rep_chr(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. As you would expect the precision and field width values are used from the format, so the length of the memory block printed is the lower bound of the length passed and the precision. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{rep_chr}", with the gcc warning compatible alternates using "{rep_chr:%c%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "B" for bytes. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{BKMG.u}", with the gcc warning compatible alternates using "{BKMG.u:%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "B/s" for bytes per second. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{BKMG/s.u}", with the gcc warning compatible alternates using "{BKMG/s.u:%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "b" for bits. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{bKMG.u}", with the gcc warning compatible alternates using "{bKMG.u:%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "b/s" for bits per second. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{bKMG/s.u}", with the gcc warning compatible alternates using "{bKMG/s.u:%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "B" for bytes. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{BKMG.ju}", with the gcc warning compatible alternates using "{BKMG.ju:%ju}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "B/s" for bytes per second. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{BKMG/s.u}", with the gcc warning compatible alternates using "{BKMG/s.ju:%ju}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "b" for bits. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{bKMG.ju}", with the gcc warning compatible alternates using "{bKMG.ju:%ju}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a number in a human accessible form. Displaying either K, M or G after the number and before a "b/s" for bits per second. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision specifies how many digits are included after the "whole" part of the number, the default precision is 2. The padding of the number can be done with spaces or zero characters, and the '+' or ' ' modifiers will work as on unsigned ints. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{bKMG/s.ju}", with the gcc warning compatible alternates using "{bKMG/s.ju:%ju}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print ipv4 IP addresses from a struct in_addr *. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID and VSTR_TYPE_FMT_END. This pointer is a struct in_addr *, to be passed to inet_ntop(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{ipv4.p}", with the gcc warning compatible alternates using "{ipv4.p:%p}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print ipv6 IP addresses from a struct in6_addr *. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID and VSTR_TYPE_FMT_END. This pointer is a struct in6_addr *, to be passed to inet_ntop(). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{ipv4.p}", with the gcc warning compatible alternates using "{ipv4.p:%p}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print ipv4 IP addresses from a vector of 4 unsigned char. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID and VSTR_TYPE_FMT_END, the vector is one unsigned char for each part of the ipv4 address. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{ipv4.v}", with the gcc warning compatible alternates using "{ipv4.v:%p}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print ipv6 IP addresses from a vector of 8 unsigned int. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID, VSTR_TYPE_FMT_UINT and VSTR_TYPE_FMT_END, the vector is one unsigned int for each part of the ipv6 address, the second argument of flags, change how the ipv6 address is printed. Note: The function will return 0 if it needs to allocate memory and cannot do so. If the configuration (Parameter[1]) is NULL, then the global configuration is used. It is recommended that you use the name "{ipv6.v}", with the gcc warning compatible alternates using "{ipv6.v:%p%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print ipv4 IP addresses with a CIDR mask from a vector of 4 unsigned char and an unsigned int. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID, VSTR_TYPE_FMT_UINT and VSTR_TYPE_FMT_END, the vector is one unsigned char for each part of the ipv4 address. Note: The function will return 0 if it needs to allocate memory and cannot do so. If the configuration (Parameter[1]) is NULL, then the global configuration is used. It is recommended that you use the name "{ipv4.v+C}", with the gcc warning compatible alternates using "{ipv4.v+C:%p%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print ipv6 IP addresses with a CIDR mask from a vector of 8 unsigned int and an unsigned int. It is equivalent to calling vstr_add_fmt() with the type arguments of VSTR_TYPE_FMT_PTR_VOID, VSTR_TYPE_FMT_UINT, VSTR_TYPE_FMT_UINT and VSTR_TYPE_FMT_END, the vector is one unsigned int for each part of the ipv6 address, the second argument of flags, change how the ipv6 address is printed. Note: The function will return 0 if it needs to allocate memory and cannot do so. If the configuration (Parameter[1]) is NULL, then the global configuration is used. It is recommended that you use the name "{ipv6.v+C}", with the gcc warning compatible alternates using "{ipv6.v+C:%p%u%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print an unsigned int number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{B.u}", with the gcc warning compatible alternates using "{B.u:%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print an unsigned long number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{B.lu}", with the gcc warning compatible alternates using "{B.lu:%lu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a size_t number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{B.zu}", with the gcc warning compatible alternates using "{B.zu:%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a uintmax_t number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{B.ju}", with the gcc warning compatible alternates using "{B.ju:%ju}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print an unsigned int number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{b.u}", with the gcc warning compatible alternates using "{b.u:%u}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print an unsigned long number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{b.lu}", with the gcc warning compatible alternates using "{b.lu:%lu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a size_t number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{b.zu}", with the gcc warning compatible alternates using "{b.zu:%zu}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Parameter[2]: Specifier name, for use with vstr_add_vfmt()
Explanation: This function is used to add a custom specifier function to print a uintmax_t number in a base 2 form. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The precision, field width, #, + and - attributes all act as they would on hex or octal numbers (Ie. %x or %o). The # flag prints a "0b" in the same way hex prints "0x". The function will return 0 if it needs to allocate memory and cannot do so. It is recommended that you use the name "{b.ju}", with the gcc warning compatible alternates using "{b.ju:%ju}" etc. vstr_sc_fmt_add_all() will add this formatter using those names.
Parameter[1]: Vstr configuration
Explanation: This function is a shortcut to adding a custom formatter for each of the specific custom formatters. The names used are as those given in the notes section of each custom formatter. Also 4 alternate names are given so that the formatter can be used in a gcc warning compatible way. For instance the vstr_add_buf() formatter is "{buf}", however the names "{buf:%s%zu}", "{buf:%*s%zu}", "{buf:%.*s%zu}", "{buf:%*.*s%zu}", "{buf:%d%s%zu}" and "{buf:%d%d%s%zu}" are also added (the later two are slightly less readable, but required for custom formaters whos first argument is a %p. Note: The function will return 0 if it needs to allocate memory and cannot do so. If the configuration (Parameter[1]) is NULL, then the global configuration is used. If any of the custom formatter adds fails (for example, if the name is already in use) then all the rest of the names of that type will fail, however the other remaining types of formatters will be tried.
Parameter[1]: Vstr configuration
Parameter[2]: Function to add the custom formatter ability
Parameter[3]: Prefix string
Parameter[4]: Static format check string, without the
leading % sign
Parameter[5]: Postfix string
Explanation: This macro function calls the function to add the custom formatting ability (Parameter[2]), with the Vstr configuration (Parameter[1]) and a string composed of the values from prefix, and the postfix. It then calls the function with the prefix, various middle strings with the static format check string, and the postfix. For example the following call... VSTR_SC_FMT_ADD(NULL, func, "<foo", "p", ">"); ...will register the format "<foo>", but also the formats "<foo:%p>", "<foo:%p>", "<foo:%*p>", "<foo:%.*p>", "<foo:%*.*p>", "<foo:%d%p>" and "<foo:%d%d%p>". This is all that is required to fool static format string checkers, even when you are passing formating information in parameters. Note: No cleanup is done on failure, so if the second registration fails then the first custom formatter will still be registered on return.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: File descriptor
Parameter[4]: Offset to start map in file descriptor
Parameter[5]: Size of map in file descriptor
Parameter[6]: Returns error code starting
VSTR_TYPE_SC_MMAP_FD_ERR_
Explanation: This function is used to add a mmap()d mapping of data from a file descriptor (Parameter[3]) at offset (Parameter[4]) and of size (Parameter[5]) to a Vstr string. Note: If the size (Parameter[5]) is zero, then then the size of the file is automatically worked out and the size (Parameter[5]) becomes the file size minus the offset (Parameter[4]).
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Filename to add a mapping from
Parameter[4]: Offset to start map in file open()'d by
filename
Parameter[5]: Size of map in file open()'d by filename
Parameter[6]: Returns error code starting
VSTR_TYPE_SC_MMAP_FILE_ERR_
Explanation: This function is used to add a mmap()d mapping of the entire data of filename (Parameter[3]) to a Vstr string.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: File descriptor
Parameter[4]: Minimum amount of nodes to read into
Parameter[5]: Maximum amount of nodes to read into
Parameter[6]: Returns error code starting
VSTR_TYPE_SC_READ_FD_ERR_
Explanation: This function is used to call vstr_add_iovec_buf_beg(), then readv() with the file descriptor (Parameter[3]) and finally vstr_add_iovec_buf_end() before returning.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: File descriptor
Parameter[4]: Size of data to try to read
Parameter[5]: Returns error code starting
VSTR_TYPE_SC_READ_FD_ERR_
Explanation: This function is used to call vstr_add_iovec_buf_beg(), then readv() with the file descriptor (Parameter[3]) and finally vstr_add_iovec_buf_end() before returning. However the arguments to the vstr_add_iovec_buf_* calls are limited so that only up to size (Parameter[4]) data will be read. If size (Parameter[4]) is zero then the entire file will try to be read. Note: As with all calls in the vstr library, this is a non-blocking call. If you need all of the data specified (Parameter[4]) then you'll need to loop.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Filename to read from
Parameter[4]: Offset to start reading at
Parameter[5]: Minimum amount of nodes to read into
Parameter[6]: Maximum amount of nodes to read into
Parameter[7]: Returns error code starting
VSTR_TYPE_SC_READ_FILE_ERR_
Explanation: This function is used to call vstr_add_iovec_buf_beg(), then readv() with the file descriptor got by opening the filename (Parameter[3]) and finally vstr_add_iovec_buf_end() before returning. However the arguments to the vstr_add_iovec_buf_* calls are limited so that only up to size (Parameter[4]) data will be read. However the arguments to the vstr_add_iovec_buf_* calls are limited so that only up to exactly size (Parameter[4]) data will be read. If size (Parameter[5]) is zero then the entire file, minus the offset (Parameter[4]) will try and be read. Note: If all the data is read() and then close() fails with an error, although the error code will signify this the data will stay inside the Vstr as this seemed the most useful/sane behaviour. read() is called multiple times from this function, so it should return after either all the data has been read from the file into the Vstr or an error has occured.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Filename to read from
Parameter[4]: Offset to start reading at
Parameter[5]: Size of data to try to read
Parameter[6]: Returns error code starting
VSTR_TYPE_SC_READ_FILE_ERR_
Explanation: This function is used to call vstr_add_iovec_buf_beg(), then readv() with the file descriptor got by opening the filename (Parameter[3]) and finally vstr_add_iovec_buf_end() before returning. However the arguments to the vstr_add_iovec_buf_* calls are limited so that only up to exactly size (Parameter[4]) data will be read. If size (Parameter[5]) is zero then the entire file, minus the offset (Parameter[4]) will try and be read. Note: If all the data is read() and then close() fails with an error, although the error code will signify this the data will stay inside the Vstr as this seemed the most useful/sane behaviour. read() is called multiple times from this function, so it should return after either all the data has been read from the file into the Vstr or an error has occured.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[3]: File descriptor
Parameter[4]: Returns error code starting
VSTR_TYPE_SC_WRITE_FD_ERR_
Explanation: This function is used to take data from a Vstr string and write it to a file descriptor. Specifically this means that after the call any data written will be removed from the Vstr (Parameter[1]), making write analogous to read which fills in the data. Note: If the start position is 1, the length is (Parameter[1])->len and caching is available for the Vstr string the data will be exported as though vstr_export_iovec_ptr_all(), writev() and then vstr_del() were called.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Filename to add a mapping from
Parameter[5]: Flags to pass to the open() system call
Parameter[6]: Mode to pass to the open() system call
Parameter[7]: Offset to start writing at
Parameter[8]: Returns error code starting
VSTR_TYPE_SC_WRITE_FILE_ERR_
Explanation: This function is used to take data from a Vstr string and write it to a file, after open()ing the file (Parameter[4]) with open flags (Parameter[5]) and open mode (Parameter[6]). Note: Because multiple system calls will be done inside this function, and that doing a write automatically removes data it's possible for this function to return failure but have actually written some data out. The other alternative would be to copy all the data until after the close() happened, which would be vastly less efficient.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Binary value to add
Explanation: This function is used to add a 16bit (two byte) binary value (Parameter[3]), in Big Endian format, to the Vstr string (Parameter[1]). Note: This function is here because too many existing network protcols send binary values, in Big Endian format. This does not mean it is a good thing to do for new protcols, look at netstrings or something equally nicer.
Parameter[1]: Vstr string
Parameter[2]: Append position in the Vstr string
(Parameter[1])
Parameter[3]: Binary value to add
Explanation: This function is used to add a 32bit (four byte) binary value (Parameter[3]), in Big Endian format, to the Vstr string (Parameter[1]). Note: This function is here because too many existing network protcols send binary values, in Big Endian format. This does not mean it is a good thing to do for new protcols, look at netstrings or something equally nicer.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Binary value to add
Explanation: This function is used to substitute a 16bit (two byte) binary value (Parameter[4]), in Big Endian format, to the Vstr string (Parameter[1]). Note: This function is here because too many existing network protcols send binary values, in Big Endian format. This does not mean it is a good thing to do for new protcols, look at netstrings or something equally nicer.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Binary value to add
Explanation: This function is used to substitute a 32bit (four byte) binary value (Parameter[4]), in Big Endian format, to the Vstr string (Parameter[1]). Note: This function is here because too many existing network protcols send binary values, in Big Endian format. This does not mean it is a good thing to do for new protcols, look at netstrings or something equally nicer.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Explanation: This function is used to parse a 16bit (two byte) binary value (Parameter[4]), in Big Endian format, from the Vstr string (Parameter[1]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: This function is here because too many existing network protcols send binary values, in Big Endian format. This does not mean it is a good thing to do for new protcols, look at netstrings or something equally nicer.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Explanation: This function is used to parse a 32bit (four byte) binary value (Parameter[4]), in Big Endian format, from the Vstr string (Parameter[1]). If the function can detect that the values of parameters are in error the function will return 0 to indicate an error. Note: This function is here because too many existing network protcols send binary values, in Big Endian format. This does not mean it is a good thing to do for new protcols, look at netstrings or something equally nicer. Interator functionsFunction: vstr_iter_fwd_beg() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Parameter[4]: Vstr iteration
Explanation: This function is used to initialized an iteration. Note: The only time this function will return FALSE is if you pass an invalid position and length. If you alter the Vstr string (Parameter[1]) while using a iteration, then the iteration will be in an undefined state.
Parameter[1]: Vstr iteration
Explanation: This function is used to step to the next iteration. Note: If you alter the Vstr string (Parameter[1]) while using a iteration, then the iteration will be in an undefined state.
Parameter[1]: Vstr iteration
Parameter[2]: Vstr iteration return type
(VSTR_TYPE_ITER_*).
Explanation: This function is used to return the current character and post increment the iteration (Ie think "ret = *iter++"). However it is safe to call vstr_iter_fwd_chr() forever, after it gets to the end of the iteration it will just return 0 (and set the return type to _END). Note: If you alter the Vstr string (Parameter[1]) while using a iteration, then the iteration will be in an undefined state.
Parameter[1]: Vstr iteration
Parameter[2]: Length to move iteration forward
(Parameter[1])
Parameter[3]: Data array to export to
Parameter[4]: Length of data (Parameter[3])
Parameter[5]: Vstr iteration return type
(VSTR_TYPE_ITER_*).
Explanation: This function is used to move the iteration forward a particular length (Parameter[2]). It will also export the data for the length, if there is room. It is safe to call vstr_iter_fwd_buf() forever, after it gets to the end of the iteration it will just return 0 (and set the return type to _END). If the passed length is greater than the length of the iteration left, the length will be truncated and the truncated value will be returned. Passing NULL as the buffer (Parameter[3]) is only valid if the buffer length (Parameter[4]) is zero. Note: If you alter the Vstr string (Parameter[1]) while using a iteration, then the iteration will be in an undefined state.
Parameter[1]: Vstr iteration
Parameter[2]: Length to move iteration forward
(Parameter[1])
Parameter[3]: Data array to export to
Parameter[4]: Length of data (Parameter[3])
Parameter[5]: Vstr iteration return type
(VSTR_TYPE_ITER_*).
Explanation: This function works like vstr_iter_fwd_buf(), except that the buffer (Parameter[3]) must be non-NULL and the end of the data exported using the iteration will always be NIL terminated.
Parameter[1]: Vstr iteration
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function is used to return the current position in the iteration.
Parameter[1]: Vstr iteration
Explanation: This function is used to return the length remaining of the iteration. Miscellaneous functionsFunction: vstr_cntl_opt() Returns: TRUE on success and FALSE on failure Type: int Parameter[1]: Option type starting VSTR_CNTL_OPT_*
Parameter[ ... ]: Options depending on value of
Parameter[1]
Explanation: This function will get or set global options.
Parameter[1]: Vstr string
Parameter[2]: Option type starting VSTR_CNTL_BASE_*
Parameter[ ... ]: Options depending on value of
Parameter[2]
Explanation: This function will get or set options for the Vstr string (Parameter[1]).
Parameter[1]:.br Type[1]: struct Vstr_conf * Parameter[2]: Option type starting VSTR_CNTL_CONF_*
Parameter[ ... ]: Options depending on value of
Parameter[2]
Explanation: This function will get or set options for the Vstr configuration (Parameter[1]). Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Name of flag type to use.
Parameter[ ... ]: Names of a flags in the given flag type
Explanation: This isn't one macro function but a group of functions that all do the same thing, just with different numbers of arguments. They combine the namespace requirements so that you can specify multiple flags in a concise manner. For instance VSTR_FLAG06() combines 6 flags. So instead of having to wite... (VSTR_FLAG_CONV_UNPRINTABLE_ALLOW_NUL | VSTR_FLAG_CONV_UNPRINTABLE_ALLOW_BEL | VSTR_FLAG_CONV_UNPRINTABLE_ALLOW_BS | VSTR_FLAG_CONV_UNPRINTABLE_ALLOW_HT | VSTR_FLAG_CONV_UNPRINTABLE_ALLOW_LF | VSTR_FLAG_CONV_UNPRINTABLE_ALLOW_VT) ...you can write... VSTR_FLAG06(CONV_UNPRINTABLE_ALLOW, NUL, BEL, BS, HT, LF, VT) ...which is a lot more readable as the number of flags increases. The Range of macro functions is from VSTR_FLAG01() to VSTR_FLAG31(), the number at the end referring to how many flags are passed to it (not the number of parameters, which is one more than that).
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: This function is used to find out how many nodes are being used for a given section of a vstr. If the function can detect that the values of parameters are in error the function will return 0 to indicate an error.
Parameter[1]: Vstr configuration
Parameter[2]: Name of cache function
Parameter[3]: Function to use as callback from the cache
Explanation: This function will add the callback function (Parameter[3]) to the Vstr configuration for use in all Vstr strings that use the Vstr configuration and have a cache. The name of the cache function (Parameter[2]) should be unique, the vstr library uses names starting "/vstr__/". Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The name of the cache function should be placed in permanent storage, Ie. only the pointer to the name will be stored so you cannot malloc() the name and then free() it after calling the function. The callback function parameters, are the Vstr string, position, length, the type of callback starting VSTR_TYPE_CACHE_ and the data for the cache function. The callback function will not be called if the data for the cache function is NULL. The inline adding and delete from the Vstr strings is not performed if callbacks are registered for the string (because functions will have to be called anyway).
Parameter[1]: Vstr string
Parameter[2]: Cookie reference for cache function
Explanation: This function will get the data for the cache function.
Parameter[1]: Vstr string
Parameter[2]: Cookie reference for cache function
Parameter[3]: Data for cache function
Explanation: This function will set the data for the cache function. Note: The callback function will not be called if the data for the cache function is NULL.
Parameter[1]: Vstr configuration
Parameter[2]: Name of cache function
Explanation: This function will find a cache function name (Parameter[2]) and return the cookie reference for use in the other cache functions. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Vstr string
Parameter[2]: Start position in the Vstr string
(Parameter[1])
Parameter[3]: Length in the Vstr string (Parameter[1])
Explanation: If you are substituting data in a vstr (from an iovec export, followed by a readv for instance or changing the data in a mmap()'d area) then you can use this function to notify the vstr caching mechanisms. Note: This is a last resort function, to make the hard things possible, use the vstr_sub_*() functions instead.
Parameter[1]: Vstr string
Parameter[2]: Cookie reference for cache function
Explanation: If you have generated cache data, this function will tell the cache function to free that data. Note: A Cookie reference of "zero" means tell all cache functions to free cached data. Note that this can cause severe performance degradation if overly used.
Parameter[1]: Vstr configuration
Parameter[2]: Name of cache function
Parameter[3]: Reference to data to store in the
configuration
Explanation: This function will add the data reference (Parameter[3]) to the Vstr configuration. The name of the data reference (Parameter[2]) should be unique, the vstr library will use names starting "/vstr__/". Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. The name of the cache function should be placed in permanent storage, Ie. only the pointer to the name will be stored so you cannot malloc() the name and then free() it after calling the function (you can free it after calling vstr_data_del()). Storing a reference that is NULL is valid, and will act like storing a reference to NULL.
Parameter[1]: Vstr configuration
Parameter[2]: Name of data configuration function
Explanation: This function will find a configuration data name (Parameter[2]) and return the cookie reference for use in the other data functions. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Vstr string
Parameter[2]: Cookie reference for configuration data
function
Explanation: This function will release the reference on the configuration data, and allow the cookie to be reused on a later vstr_data_add() call. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Vstr string
Parameter[2]: Cookie reference for configuration data
function
Explanation: This function will get the data for the configuration data storage function. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used.
Parameter[1]: Vstr string
Parameter[2]: Cookie reference for configuration data
function
Parameter[3]: Reference to data to store in the
configuration
Explanation: This function will set the data for the configuration data storage function. Note: If the configuration (Parameter[1]) is NULL, then the global configuration is used. Storing a reference that is NULL is valid, and will act like storing a reference to NULL. All allocations are done at vstr_data_add() time, so this function can never fail.
Parameter[1]: Vstr string
Parameter[2]: New Vstr configuration; returned old Vstr
configuration
Explanation: This function will swap a Vstr configuration into a Vstr string possibly changing the Vstr configuration to be compatible with the Vstr string. On success the Vstr configuration that was being used by the Vstr string is returned. Note: Using this function allows you to use vstr_add_fmt() and vstr_add_vfmt() on a Vstr that you don't own, by doing... if (vstr_swap_conf(notmy_vstr_string, &my_vstr_conf)) { vstr_add_fmt(notmy_vstr_string, ... ); vstr_swap_conf(notmy_vstr_string, &my_vstr_conf); } ...note that the last call swaps the configuration back. However if you are not using any custom specifiers then you can just call vstr_add_sysfmt() instead. The function will return 0 if it needs to allocate memory and cannot do so. SEE ALSOvstr_const(3)
Visit the GSP FreeBSD Man Page Interface. |