-/**
- * Prints the error message corresponding to a regex error code.
- *
- * @param errcode The error code.
- * @param regex The regex object that produced the error code.
- */
-static void regex_print_error(int errcode, regex_t *regex)
-{
- /* Get length of error message and allocate accordingly */
- size_t length;
- char *buffer;
-
- assert(regex != NULL);
-
- length = regerror(errcode, regex, NULL, 0);
- if (length == 0) {
- ERR("regerror returned a length of 0");
- return;
- }
-
- buffer = zmalloc(length);
- if (!buffer) {
- ERR("regex_print_error: zmalloc failed");
- return;
- }
-
- /* Get and print error message */
- regerror(errcode, regex, buffer, length);
- ERR("regex error: %s\n", buffer);
- free(buffer);
-
-}