|
mUPnP for C
|
Functions | |
| char * | mupnp_strdup (const char *str) |
| Duplicate a string (NULL-safe wrapper for strdup) | |
| size_t | mupnp_strlen (const char *str) |
| Get the length of a string (NULL-safe wrapper for strlen) | |
| char * | mupnp_strcpy (char *dest, const char *src) |
| Copy a string (NULL-safe wrapper for strcpy) | |
| char * | mupnp_strcat (char *dest, const char *src) |
| Concatenate strings (NULL-safe wrapper for strcat) | |
| int | mupnp_strcmp (const char *str1, const char *str2) |
| Compare two strings (NULL-safe wrapper for strcmp) | |
| int | mupnp_strncmp (const char *str1, const char *str2, int nchars) |
| Compare first n characters of two strings (NULL-safe) | |
| int | mupnp_strcasecmp (const char *str1, const char *str2) |
| Compare two strings case-insensitively (NULL-safe) | |
| bool | mupnp_streq (const char *str1, const char *str2) |
| Test if two strings are equal (NULL-safe) | |
| bool | mupnp_strcaseeq (const char *str1, const char *str2) |
| Test if two strings are equal case-insensitively (NULL-safe) | |
| ssize_t | mupnp_strstr (const char *haystack, const char *needle) |
| Find substring (NULL-safe wrapper for strstr) | |
| ssize_t | mupnp_strchr (const char *str, const char *chars, size_t nchars) |
| Find first occurrence of any character from a set (strcspn variant) | |
| ssize_t | mupnp_strrchr (const char *str, const char *chars, size_t nchars) |
| Find last occurrence of any character from a set. | |
| char * | mupnp_strtrimwhite (char *str) |
| Trim whitespace from both ends of a string (in-place) | |
| char * | mupnp_strtrim (char *str, char *delim, size_t ndelim) |
| Trim specified delimiter characters from both ends (in-place) | |
| char * | mupnp_strltrim (char *str, char *delim, size_t ndelim) |
| Trim delimiter characters from the left (start) of string (in-place) | |
| char * | mupnp_strrtrim (char *str, char *delim, size_t ndelim) |
| Trim delimiter characters from the right (end) of string (in-place) | |
| char * | mupnp_strncpy (char *str1, const char *str2, size_t cnt) |
| Copy at most n characters from one string to another (NULL-safe) | |
| char * | mupnp_strncat (char *str1, const char *str2, size_t cnt) |
| Append at most n characters from one string to another (NULL-safe) | |
| const char * | mupnp_int2str (int value, char *buf, size_t bufSize) |
| Convert integer to string. | |
| const char * | mupnp_long2str (long value, char *buf, size_t bufSize) |
| Convert long integer to string. | |
| const char * | mupnp_float2str (float value, char *buf, size_t bufSize) |
| Convert float to string. | |
| const char * | mupnp_double2str (double value, char *buf, size_t bufSize) |
| Convert double to string. | |
| const char * | mupnp_sizet2str (size_t value, char *buf, size_t bufSize) |
| Convert size_t to string. | |
| const char * | mupnp_ssizet2str (ssize_t value, char *buf, size_t bufSize) |
| Convert ssize_t to string. | |
| const char * mupnp_double2str | ( | double | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert double to string.
| value | The double value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_DOUBLE_BUFLEN (64) to safely hold any double. |
| const char * mupnp_float2str | ( | float | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert float to string.
| value | The float value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_FLOAT_BUFLEN (64) to safely hold any float. |
| const char * mupnp_int2str | ( | int | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert integer to string.
| value | The integer value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_INTEGER_BUFLEN (16) to safely hold any int. |
| const char * mupnp_long2str | ( | long | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert long integer to string.
| value | The long value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_LONG_BUFLEN (32) to safely hold any long. |
| const char * mupnp_sizet2str | ( | size_t | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert size_t to string.
| value | The size_t value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_LONG_BUFLEN (32) bytes. |
| const char * mupnp_ssizet2str | ( | ssize_t | value, |
| char * | buf, | ||
| size_t | bufSize ) |
Convert ssize_t to string.
| value | The ssize_t value to convert. |
| buf | Buffer to store the result. Must not be NULL. |
| bufSize | Size of buf in bytes. Should be at least MUPNP_STRING_LONG_BUFLEN (32) bytes. |
| int mupnp_strcasecmp | ( | const char * | str1, |
| const char * | str2 ) |
Compare two strings case-insensitively (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| bool mupnp_strcaseeq | ( | const char * | str1, |
| const char * | str2 ) |
Test if two strings are equal case-insensitively (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| char * mupnp_strcat | ( | char * | dest, |
| const char * | src ) |
Concatenate strings (NULL-safe wrapper for strcat)
| dest | Destination buffer. Must not be NULL and must have sufficient space. |
| src | Source string to append. May be NULL (no-op if NULL). |
| ssize_t mupnp_strchr | ( | const char * | str, |
| const char * | chars, | ||
| size_t | nchars ) |
Find first occurrence of any character from a set (strcspn variant)
| str | The string to search. Must not be NULL. |
| chars | Array of characters to search for. Must not be NULL. |
| nchars | Number of characters in chars array. |
| int mupnp_strcmp | ( | const char * | str1, |
| const char * | str2 ) |
Compare two strings (NULL-safe wrapper for strcmp)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| char * mupnp_strcpy | ( | char * | dest, |
| const char * | src ) |
Copy a string (NULL-safe wrapper for strcpy)
| dest | Destination buffer. Must not be NULL and must be large enough. |
| src | Source string. May be NULL (dest will be set to empty string). |
| char * mupnp_strdup | ( | const char * | str | ) |
Duplicate a string (NULL-safe wrapper for strdup)
Allocates memory and creates a copy of the input string. The caller is responsible for freeing the returned string with free().
| str | The string to duplicate. May be NULL. |
| bool mupnp_streq | ( | const char * | str1, |
| const char * | str2 ) |
Test if two strings are equal (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| size_t mupnp_strlen | ( | const char * | str | ) |
Get the length of a string (NULL-safe wrapper for strlen)
| str | The string to measure. May be NULL. |
| char * mupnp_strltrim | ( | char * | str, |
| char * | delim, | ||
| size_t | ndelim ) |
Trim delimiter characters from the left (start) of string (in-place)
| str | The string to trim. Must not be NULL. Will be modified. |
| delim | Array of delimiter characters to remove. Must not be NULL. |
| ndelim | Number of characters in delim array. |
| char * mupnp_strncat | ( | char * | str1, |
| const char * | str2, | ||
| size_t | cnt ) |
Append at most n characters from one string to another (NULL-safe)
| str1 | Destination buffer. Must not be NULL and must have sufficient space. |
| str2 | Source string to append. May be NULL (no-op if NULL). |
| cnt | Maximum number of characters to append (excluding null terminator). |
| int mupnp_strncmp | ( | const char * | str1, |
| const char * | str2, | ||
| int | nchars ) |
Compare first n characters of two strings (NULL-safe)
| str1 | First string. May be NULL. |
| str2 | Second string. May be NULL. |
| nchars | Maximum number of characters to compare. |
| char * mupnp_strncpy | ( | char * | str1, |
| const char * | str2, | ||
| size_t | cnt ) |
Copy at most n characters from one string to another (NULL-safe)
| str1 | Destination buffer. Must not be NULL and must have space for cnt+1 bytes. |
| str2 | Source string. May be NULL (str1 will be set to empty string). |
| cnt | Maximum number of characters to copy (excluding null terminator). |
| ssize_t mupnp_strrchr | ( | const char * | str, |
| const char * | chars, | ||
| size_t | nchars ) |
Find last occurrence of any character from a set.
| str | The string to search. Must not be NULL. |
| chars | Array of characters to search for. Must not be NULL. |
| nchars | Number of characters in chars array. |
| char * mupnp_strrtrim | ( | char * | str, |
| char * | delim, | ||
| size_t | ndelim ) |
Trim delimiter characters from the right (end) of string (in-place)
| str | The string to trim. Must not be NULL. Will be modified. |
| delim | Array of delimiter characters to remove. Must not be NULL. |
| ndelim | Number of characters in delim array. |
| ssize_t mupnp_strstr | ( | const char * | haystack, |
| const char * | needle ) |
Find substring (NULL-safe wrapper for strstr)
| haystack | The string to search in. May be NULL. |
| needle | The substring to search for. May be NULL. |
| char * mupnp_strtrim | ( | char * | str, |
| char * | delim, | ||
| size_t | ndelim ) |
Trim specified delimiter characters from both ends (in-place)
| str | The string to trim. Must not be NULL. Will be modified. |
| delim | Array of delimiter characters to remove. Must not be NULL. |
| ndelim | Number of characters in delim array. |
| char * mupnp_strtrimwhite | ( | char * | str | ) |
Trim whitespace from both ends of a string (in-place)
Removes leading and trailing whitespace characters (space, tab, newline, carriage return) from the string by modifying it in place.
| str | The string to trim. Must not be NULL. Will be modified. |