fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
Loading...
Searching...
No Matches
string.c File Reference

String parsing function implementations. More...

#include "string.h"
#include <assert.h>
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
Include dependency graph for string.c:

Functions

int strtolb (const char *const str, const long min, const long max, void *const p, const int ps)
 Attempts to parse the given string as a long using strtol. If the parsed value is within the given range, it is stored in the given pointer using memcpy, which results in a type-agnostic function. The size of the destination type must be provided in bytes. The destination is only updated if the parsed value is within the given range. The caller should take care to ensure the destination type is large enough to store the parsed value.
 

Detailed Description

String parsing function implementations.

Function Documentation

◆ strtolb()

int strtolb ( const char * str,
long min,
long max,
void * p,
int ps )

Attempts to parse the given string as a long using strtol. If the parsed value is within the given range, it is stored in the given pointer using memcpy, which results in a type-agnostic function. The size of the destination type must be provided in bytes. The destination is only updated if the parsed value is within the given range. The caller should take care to ensure the destination type is large enough to store the parsed value.

Parameters
strstring to parse
minminimum value (inclusive) supported by the destination type
maxmaximum value (inclusive) supported by the destination type
ppointer to store the parsed value
pssize of the destination type in bytes
Returns
0 on success, non-zero on failure
Here is the caller graph for this function: