Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: xively-jumpstart-demo
xi_helpers.c File Reference
General helpers used by the library [see xi_helpers.h]. More...
Go to the source code of this file.
Functions | |
char * | xi_str_dup (const char *s) |
int | xi_str_copy_untiln (char *dst, size_t dst_size, const char *src, char delim) |
Copies `src` string into `dst`, but stops whenever `delim` is reached or the `dst_size` is exceeded. | |
struct tm * | xi_gmtime (time_t *t) |
This just wraps system's `gmtime()`, it a facade for future use. | |
char * | xi_replace_with (char p, char r, char *buffer, size_t max_chars) |
Replaces `p` with `r` for every `p` in `buffer`. |
Detailed Description
General helpers used by the library [see xi_helpers.h].
Definition in file xi_helpers.c.
Function Documentation
struct tm* xi_gmtime | ( | time_t * | t ) | [read] |
This just wraps system's `gmtime()`, it a facade for future use.
Definition at line 165 of file xi_helpers.c.
char* xi_replace_with | ( | char | p, |
char | r, | ||
char * | buffer, | ||
size_t | max_chars | ||
) |
Replaces `p` with `r` for every `p` in `buffer`.
- Returns:
- Pointer to converted buffer.
- Note:
- This function assumes that the buffer is terminated with `\0`.
Definition at line 170 of file xi_helpers.c.
int xi_str_copy_untiln | ( | char * | dst, |
size_t | dst_size, | ||
const char * | src, | ||
char | delim | ||
) |
Copies `src` string into `dst`, but stops whenever `delim` is reached or the `dst_size` is exceeded.
- Returns:
- Number of copied characters or -1 if an error occurred.
Definition at line 31 of file xi_helpers.c.
char* xi_str_dup | ( | const char * | s ) |
- Note:
- Needed to avoid using `strdup()` which can cause some problems with `free()`, because of buggy `realloc()` implementations.
- Returns:
- Duplicated string or null in case of memory allocation problem.
Definition at line 19 of file xi_helpers.c.
Generated on Wed Jul 13 2022 17:00:33 by
