Extra functions for sds strings.
More...
#include "dist/sds/sds.h"
#include <stdbool.h>
#include <stdio.h>
Go to the source code of this file.
Extra functions for sds strings.
◆ FREE_SDS
| #define FREE_SDS |
( |
| SDS_PTR | ) |
|
Value: do { \
sdsfree(SDS_PTR); \
SDS_PTR = NULL; \
} while (0)
Frees an sds string and sets it to NULL
◆ sds_catbool()
| sds sds_catbool |
( |
sds | s, |
|
|
bool | v ) |
Converts a bool value to a sds string
- Parameters
-
| s | string to append the value |
| v | bool value to convert |
- Returns
- modified sds string
◆ sds_catchar()
| sds sds_catchar |
( |
sds | s, |
|
|
const char | c ) |
Appends a char to sds string s, this is faster than using sdscatfmt
- Parameters
-
| s | sds string |
| c | char to append |
- Returns
- modified sds string
◆ sds_free_void()
| void sds_free_void |
( |
void * | p | ) |
|
Frees an sds string pointed by void pointer
- Parameters
-
| p | Void pointer to sds string |
◆ sds_merge_lines()
| void sds_merge_lines |
( |
sds | s | ) |
|
Removes newline characters from a string in-place.
- Parameters
-
| s | String to merge the lines |
◆ sds_pad_int()
| sds sds_pad_int |
( |
int64_t | value, |
|
|
sds | buffer ) |
Prints a zero padded value
- Parameters
-
| value | mpd song struct |
| buffer | already allocated sds string to append |
- Returns
- pointer to buffer
◆ sds_replace()
| sds sds_replace |
( |
sds | s, |
|
|
const char * | p ) |
Replaces a sds string with a new value, allocates the string if it is NULL
- Parameters
-
| s | sds string to replace |
| p | replacement string |
- Returns
- modified sds string
◆ sds_replacelen()
| sds sds_replacelen |
( |
sds | s, |
|
|
const char * | p, |
|
|
size_t | len ) |
Replaces a sds string with a new value, allocates the string if it is NULL
- Parameters
-
| s | sds string to replace |
| p | replacement string |
| len | replacement string length |
- Returns
- modified sds string
◆ sds_split_comma_trim()
| sds * sds_split_comma_trim |
( |
const char * | p, |
|
|
int * | count ) |
Splits a comma separated string and trims whitespaces from single values
- Parameters
-
| p | string to split |
| count | pointer to int representing the count of values |
- Returns
- array of sds strings