Functions |
Eina_Tmpstr * | eina_tmpstr_add (const char *str) |
| Adds a new temporary string based on the input string.
|
Eina_Tmpstr * | eina_tmpstr_add_length (const char *str, size_t length) |
| Adds a new temporary string based on the input string and length.
|
size_t | eina_tmpstr_strlen (Eina_Tmpstr *tmpstr) |
| Returns the length of a temporary string including the '\0'.
|
void | eina_tmpstr_del (Eina_Tmpstr *tmpstr) |
| Deletes the temporary string if it is one, or ignores it if it is not.
|
Typedefs |
typedef const char | Eina_Tmpstr |
| Interchangeable with "const char *", but still a good visual hint for the purpose. This indicates that the string is temporary and should be freed after use.
|
Eina tmpstr is intended for being able to conveniently pass strings back to a calling parent without having to use single static buffers (which don't work with multiple threads or when returning multiple times as parameters to a single function.
eina_tmpstr_page
Typedef Documentation
Interchangeable with "const char *", but still a good visual hint for the purpose. This indicates that the string is temporary and should be freed after use.
- Since (EFL) :
- 1.8.0
Function Documentation
Adds a new temporary string based on the input string.
- Since (EFL) :
- 1.8.0
- Since :
- 2.3
Example usage:
- Parameters:
-
[in] | str | The input string that is copied into the temp string |
- Returns:
- A pointer to the tmp string that is a standard C string
- See also:
- eina_tmpstr_del()
-
eina_tmpstr_add_length()
Adds a new temporary string based on the input string and length.
- Since (EFL) :
- 1.8.0
- Since :
- 2.3
- Note:
- If the length is greater than the actual string, but still '\0' terminateed. Their won't be any crash and the string will be correct, but eina_tmpstr_strlen will return an erroneous length. So if you want to have the correct length always call eina_tmpstr_add_length with length == strlen(str).
- Parameters:
-
[in] | str | The input string that is copied into the temp string |
[in] | length | The maximum length and the allocated length of the temp string |
- Returns:
- A pointer to the tmp string that is a standard C string
- See also:
- eina_tmpstr_del()
-
eina_tmpstr_add()
Deletes the temporary string if it is one, or ignores it if it is not.
This deletes the given temporary string tmpstr if it is a valid temporary string, otherwise it ignores it and does nothing, so this can be used safely with non-temporary strings.
- Since (EFL) :
- 1.8.0
- Since :
- 2.3
- Parameters:
-
[in] | tmpstr | A C string pointer, but if it is a tmp string it is freed |
- See also:
- eina_tmpstr_add()
Returns the length of a temporary string including the '\0'.
- Since (EFL) :
- 1.8.0
- Since :
- 2.3
- Parameters:
-
[in] | tmpstr | A C string pointer, but if it is a tmp string it returns the length faster |
- Returns:
- The length of the string including the '\0'