Volksdata 1.0b10
RDF library
Loading...
Searching...
No Matches
Collaboration diagram for Utilities:

Functions

VOLK_rc mkdir_p (const char *path, mode_t mode)
 Make recursive directories.
VOLK_rc rm_r (const char *path)
 Remove a directory recursively, as in Unix "rm -r".
char * strdup (const char *src)
 Replacement for GNU strdup.
char * strndup (const char *src, size_t max)
 Replacement for GNU strndup.
int utf8_encode (const uint32_t utf, unsigned char *out)
 Encode a code point using UTF-8.

Detailed Description

Function Documentation

◆ mkdir_p()

VOLK_rc mkdir_p ( const char * path,
mode_t mode )

Make recursive directories.

Modified from https://gist.github.com/JonathonReinhart/8c0d90191c38af2dcadb102c4e202950

Definition at line 50 of file core.c.

◆ rm_r()

VOLK_rc rm_r ( const char * path)

Remove a directory recursively, as in Unix "rm -r".

Parameters
[in]pathPath of directory to remove.

Remove a directory recursively, as in Unix "rm -r".

Adapted from https://stackoverflow.com/questions/5467725/how-to-delete-a-directory-and-its-contents-in-posix-c/42596507#42596507

Definition at line 124 of file core.c.

◆ strdup()

char * strdup ( const char * src)

Replacement for GNU strdup.

param[in] str String to duplicate.

return Duplicated string. The caller is in charge of freeing it after use.

Definition at line 109 of file core.c.

◆ strndup()

char * strndup ( const char * src,
size_t max )

Replacement for GNU strndup.

param[in] src String to duplicate. param[in] max Max number of characters to duplicate. The length is capped to the smaller value between this and the source string length (characters up to the trailing \0).

return Duplicated string. The caller is in charge of freeing it after use.

Definition at line 92 of file core.c.

◆ utf8_encode()

int utf8_encode ( const uint32_t utf,
unsigned char * out )
inline

Encode a code point using UTF-8.

https://gist.github.com/MightyPork/52eda3e5677b4b03524e40c9f0ab1da5

Author
Ondřej Hruška ondra.nosp@m.@ond.nosp@m.rovo..nosp@m.com
Parameters
out- output buffer (min 5 characters), will be 0-terminated
utf- code point 0-0x10FFFF
Returns
number of bytes on success, 0 on failure (also produces U+FFFD, which uses 3 bytes)

Definition at line 487 of file core.h.