         let result = regcomp(&preg, pattern, options.rawValue)
 
         if result != 0 {
-            throw RegexError.errorFromResult(result, preg: preg)
+            throw RegexError.error(from: result, preg: preg)
         }
     }
 

        regfree(&preg)
    }

    public func matches(string: String, options: MatchOptions = []) -> Bool {
        var regexMatches = [regmatch_t](repeating: regmatch_t(), count: 1)
        let result = regexec(&preg, string, regexMatches.count, &regexMatches, options.rawValue)


// SOFTWARE.

@_exported import C7

#if os(Linux)
    @_exported import Glibc
#else
    @_exported import Darwin.C
#endif

struct RegexError: ErrorProtocol {
    let description: String

    static func error(from result: Int32, preg: regex_t) -> RegexError {
        var preg = preg
        var buffer = [Int8](repeating: 0, count: Int(BUFSIZ))
        regerror(result, &preg, &buffer, buffer.count)
