Commit 20f3227a authored by Lubomir Bulej's avatar Lubomir Bulej

Move string utils section in common.h

Actually, it should probably live in a separate file,
but that can wait for a while.
parent 7d511204
......@@ -74,30 +74,6 @@ int find_value_index (const char * strval, const char * values [], int nvals);
void die_with_error (const char * format, va_list args);
void die_with_std_error (int errnum, const char * format, va_list args);
// ****************************************************************************
// STRING UTILS SECTION
// ****************************************************************************
/**
* Count the occurrences of substr in string
* @param string
* @param substr
* @return
*/
size_t
substr_count(const char * string, const char * restrict substr);
/**
* Split the string into tokens
* Remember to free the result.
*
* @param string The string to split
* @param separator
* @param tokens Pointer to the size_t variable to store the number of tokens
* @return
*/
char **
split_string(char * string, const char * restrict separator, size_t * tokens);
/**
* Reports a general error and terminates the program if the provided
......@@ -144,6 +120,33 @@ warn_std_error (bool error, const char * message) {
}
}
// ****************************************************************************
// STRING UTILS SECTION
// ****************************************************************************
/**
* Count the occurrences of substr in string
* @param string
* @param substr
* @return
*/
size_t
substr_count(const char * string, const char * restrict substr);
/**
* Split the string into tokens
* Remember to free the result.
*
* @param string The string to split
* @param separator
* @param tokens Pointer to the size_t variable to store the number of tokens
* @return
*/
char **
split_string(char * string, const char * restrict separator, size_t * tokens);
//
#ifdef MINGW
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment