Remove hi_ prefixes from internal code. Add documentation.
This commit is contained in:
@@ -6,40 +6,47 @@
|
||||
/**
|
||||
* Concatenate two strings into a buffer.
|
||||
*
|
||||
* If resulting string would be longer than buflen - 1, the resulting string in
|
||||
* \p buf is unchanged.
|
||||
* If resulting string would be longer than @a buflen - 1, the resulting string
|
||||
* in
|
||||
* @a buf is unchanged.
|
||||
*
|
||||
* @param first Null terminated character string
|
||||
* @param second Null terminated character string
|
||||
*/
|
||||
size_t hi_strncat_buf(size_t bufsize, char buf[bufsize], const char *first,
|
||||
const char *second);
|
||||
size_t hi_str_concat_buf(size_t bufsize, char buf[bufsize],
|
||||
const char *first, const char *second);
|
||||
|
||||
/**
|
||||
* @brief Copy file content to a null terminated string, allocating memory while
|
||||
* Copy file content to a null terminated string, allocating memory while
|
||||
* reading.
|
||||
*
|
||||
* This doesn't assume it can read file size, so it allocates memory in chunks
|
||||
* (default 4096 bytes) and keeps reading until 0 bytes is read. If nmax is
|
||||
* non-zero, instead that amount of bytes is allocated and that is read.
|
||||
* Can be used for reading the virtual file system, where the file size isn't
|
||||
* known. If @a nmax is non-zero, that amount of bytes is allocated and read at
|
||||
* once. No more than @a nmax bytes is read in that case.
|
||||
*
|
||||
* In either case, the string is reallocated to match the length before
|
||||
* In all cases, the string is reallocated to match the length before
|
||||
* returning.
|
||||
*
|
||||
* @param filename a complete pathname to the file
|
||||
* @param nread if not null, this will have the total amount bytes read
|
||||
* @param nmax if not 0, this amount of memory in bytes is read and used as
|
||||
* initial allocation
|
||||
*/
|
||||
char *hi_string_from_file_dyn(const char *filename, size_t *nread, size_t nmax);
|
||||
char *hi_str_from_file(const char *filename, size_t *nread,
|
||||
size_t nmax);
|
||||
|
||||
/**
|
||||
* Find if filename exists at the end of path.
|
||||
* Return the first string from @a pathlist that is fully included in @a path.
|
||||
*/
|
||||
const char *hi_str_starts_with(const char path[static 1], size_t listn,
|
||||
const char *pathlist[listn]);
|
||||
|
||||
|
||||
/**
|
||||
* Find if @a filename exists at the end of @a path.
|
||||
*
|
||||
* @return 0 if not found, positive if found
|
||||
*/
|
||||
int hi_path_has_filename(const char *path, const char *filename);
|
||||
|
||||
const char *hi_string_starts_with(const char path[static 1], size_t listn,
|
||||
const char *pathlist[listn]);
|
||||
|
||||
#endif // HI_STRING_H_
|
||||
|
||||
Reference in New Issue
Block a user