myMPD
Internal API documentation
Loading...
Searching...
No Matches
sds_extras.c File Reference

Extra functions for sds strings. More...

#include "src/lib/sds/sds_extras.h"
#include "dist/sds/sds.h"
#include <inttypes.h>
#include <string.h>
Include dependency graph for sds_extras.c:

Functions

void sds_merge_lines (sds s)
sds * sds_split_comma_trim (const char *p, int *count)
sds sds_catchar (sds s, const char c)
sds sds_replacelen (sds s, const char *p, size_t len)
sds sds_replace (sds s, const char *p)
sds sds_catbool (sds s, bool v)
sds sds_pad_int (int64_t value, sds buffer)
void sds_free_void (void *p)

Detailed Description

Extra functions for sds strings.

Function Documentation

◆ sds_catbool()

sds sds_catbool ( sds s,
bool v )

Converts a bool value to a sds string

Parameters
sstring to append the value
vbool 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
ssds string
cchar to append
Returns
modified sds string

◆ sds_free_void()

void sds_free_void ( void * p)

Frees an sds string pointed by void pointer

Parameters
pVoid pointer to sds string

◆ sds_merge_lines()

void sds_merge_lines ( sds s)

Removes newline characters from a string in-place.

Parameters
sString to merge the lines

◆ sds_pad_int()

sds sds_pad_int ( int64_t value,
sds buffer )

Prints a zero padded value

Parameters
valuempd song struct
bufferalready 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
ssds string to replace
preplacement 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
ssds string to replace
preplacement string
lenreplacement 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
pstring to split
countpointer to int representing the count of values
Returns
array of sds strings