Greenbone Vulnerability Management Libraries 22.10.0
|
String utilities. More...
#include <glib.h>
Go to the source code of this file.
Functions | |
void | gvm_append_string (gchar **, const gchar *) |
Append a string to a string variable. | |
void | gvm_append_text (gchar **, const gchar *, gsize) |
Append a string of a known length to a string variable. | |
void | gvm_free_string_var (gchar **) |
Free a string variable. | |
char * | gvm_strip_space (char *, char *) |
"Strip" space and newline characters from either end of some memory. | |
String utilities.
void gvm_append_string | ( | gchar ** | var, |
const gchar * | string ) |
Append a string to a string variable.
When the variable is NULL store a copy of the given string in the variable.
When the variable already contains a string replace the string with a new string that is the concatenation of the two, freeing the old string. It is up to the caller to free the given string if it was dynamically allocated.
[in] | var | The address of a string variable, that is, a pointer to a string. |
[in] | string | The string to append to the string in the variable. |
void gvm_append_text | ( | gchar ** | var, |
const gchar * | string, | ||
gsize | length ) |
Append a string of a known length to a string variable.
When the variable is NULL store a copy of the given string in the variable.
When the variable already contains a string replace the string with a new string that is the concatenation of the two, freeing the old string. It is up to the caller to free the given string if it was dynamically allocated.
The string must be NULL terminated, and the given length must be the actual length of the string.
[in] | var | The address of a string variable, that is, a pointer to a string. |
[in] | string | The string to append to the string in the variable. |
[in] | length | The length of string. |
void gvm_free_string_var | ( | gchar ** | var | ) |
Free a string variable.
Free the string in the variable and set the variable to NULL.
[in] | var | The address of a string variable, that is, a pointer to a string. |
char * gvm_strip_space | ( | char * | string, |
char * | end ) |
"Strip" space and newline characters from either end of some memory.
Return the given pointer moved forward past any spaces, replacing the first of any contiguous spaces at or before the end of the memory with a terminating NULL.
This is for use when string points into a static buffers.
[in,out] | string | The start of the memory. |
[in] | end | Pointer to the byte after the end of the memory. |